Skip to content

Commit

Permalink
Use const signature of ICanBuffer::getPointer
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBowman committed Aug 5, 2019
1 parent d91e4ca commit 2133db1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libraries/YarpPlugins/CanBusPeak/ICanBusImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <cstring> // std::memset, std::memcpy, std::strerror
#include <cerrno> // error codes

#include <yarp/conf/version.h>
#include <yarp/os/LockGuard.h>

#include <libpcanfd.h>
Expand Down Expand Up @@ -208,8 +209,12 @@ bool roboticslab::CanBusPeak::canWrite(const yarp::dev::CanBuffer & msgs, unsign
yarp::os::LockGuard lockGuard(canBusReady);

// Point at first member of an internally defined array of pcanfd_msg structs.
#if YARP_VERSION_MINOR >= 2 // note: remove #include <yarp/conf/version.h>
struct pcanfd_msg * pfdm = reinterpret_cast<struct pcanfd_msg *>(msgs.getPointer()[0]->getPointer());
#else
yarp::dev::CanBuffer & msgs_not_const = const_cast<yarp::dev::CanBuffer &>(msgs);
struct pcanfd_msg * pfdm = reinterpret_cast<struct pcanfd_msg *>(msgs_not_const.getPointer()[0]->getPointer());
#endif

for (unsigned int i = 0; i < size; i++)
{
Expand Down

0 comments on commit 2133db1

Please sign in to comment.