Fix CppCheck in p3grouter

/libretroshare/src/grouter/p3grouter.cc:2295: warning:
Cppcheck(cstyleCast): C-style pointer casting
/libretroshare/src/grouter/p3grouter.h:82: warning:
Cppcheck(uninitMemberVar): Member variable
'GRouterDataInfo::last_activity_TS' is not initialized in the
constructor.
/libretroshare/src/grouter/p3grouter.cc:206: warning:
Cppcheck(uninitMemberVar): Member variable 'p3GRouter::mTurtle' is not
initialized in the constructor.
/libretroshare/src/grouter/p3grouter.cc:206: warning:
Cppcheck(uninitMemberVar): Member variable 'p3GRouter::mLinkMgr' is not
initialized in the constructor.
This commit is contained in:
Phenom 2017-07-21 15:54:29 +02:00 committed by csoler
parent 10721945a3
commit f81c6aea03
2 changed files with 5 additions and 3 deletions

View File

@ -204,7 +204,7 @@
const std::string p3GRouter::SERVICE_INFO_APP_NAME = "Global Router" ; const std::string p3GRouter::SERVICE_INFO_APP_NAME = "Global Router" ;
p3GRouter::p3GRouter(p3ServiceControl *sc, RsGixs *is) p3GRouter::p3GRouter(p3ServiceControl *sc, RsGixs *is)
: p3Service(), p3Config(), mServiceControl(sc), mGixs(is), grMtx("GRouter") : p3Service(), p3Config(), mServiceControl(sc), mTurtle(NULL), mGixs(is), grMtx("GRouter")
{ {
addSerialType(new RsGRouterSerialiser()) ; addSerialType(new RsGRouterSerialiser()) ;
@ -2292,6 +2292,8 @@ bool p3GRouter::saveList(bool& cleanup,std::list<RsItem*>& items)
{ {
RsGRouterRoutingInfoItem *item = new RsGRouterRoutingInfoItem ; RsGRouterRoutingInfoItem *item = new RsGRouterRoutingInfoItem ;
#warning: Cppcheck(cstyleCast): C-style pointer casting
// cppcheck-suppress cstyleCast
*(GRouterRoutingInfo*)item = it->second ; // copy all members *(GRouterRoutingInfo*)item = it->second ; // copy all members
item->data_item = it->second.data_item->duplicate() ; // deep copy, because we call delete on the object, and the item might be removed before we handle it in the client. item->data_item = it->second.data_item->duplicate() ; // deep copy, because we call delete on the object, and the item might be removed before we handle it in the client.

View File

@ -79,7 +79,7 @@ class GRouterDataInfo
{ {
// ! This class does not have a copy constructor that duplicates the incoming data buffer. This is on purpose! // ! This class does not have a copy constructor that duplicates the incoming data buffer. This is on purpose!
public: public:
GRouterDataInfo() GRouterDataInfo() : last_activity_TS(0)
{ {
incoming_data_buffer = NULL ; incoming_data_buffer = NULL ;
} }
@ -339,7 +339,7 @@ private:
p3ServiceControl *mServiceControl ; p3ServiceControl *mServiceControl ;
p3turtle *mTurtle ; p3turtle *mTurtle ;
RsGixs *mGixs ; RsGixs *mGixs ;
p3LinkMgr *mLinkMgr ; //p3LinkMgr *mLinkMgr ;
// Multi-thread protection mutex. // Multi-thread protection mutex.
// //