mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Fix CppCheck in p3servicecontrol
/libretroshare/src/pqi/p3servicecontrol.cc:840: warning: Cppcheck(unreadVariable): Variable 'changes' is assigned a value that is never used. /libretroshare/src/pqi/p3servicecontrol.cc:941: warning: Cppcheck(unusedVariable): Unused variable: mit /libretroshare/src/pqi/p3servicecontrol.cc:972: warning: Cppcheck(unusedVariable): Unused variable: mit /libretroshare/src/pqi/p3servicecontrol.cc:88: warning: Cppcheck(uninitMemberVar): Member variable 'p3ServiceControl::mServiceServer' is not initialized in the constructor. /libretroshare/src/pqi/p3servicecontrol.h:69: warning: Cppcheck(noExplicitConstructor): Class 'p3ServiceControl' has a constructor with 1 argument that is not explicit. /libretroshare/src/pqi/p3servicecontrol.cc:45: warning: Cppcheck(noExplicitConstructor): Class 'RsServiceControlItem' has a constructor with 1 argument that is not explicit. /libretroshare/src/pqi/p3servicecontrol.cc:52: warning: Cppcheck(noExplicitConstructor): Class 'RsServicePermissionItem' has a constructor with 1 argument that is not explicit. /libretroshare/src/pqi/p3servicecontrol.cc:359: warning: Cppcheck(passedByValue): Function parameter 'serviceName' should be passed by reference.
This commit is contained in:
parent
d21b41f871
commit
50a9d8a1e3
@ -42,17 +42,17 @@ static const uint8_t RS_PKT_SUBTYPE_SERVICE_CONTROL_SERVICE_PERMISSIONS = 0x01 ;
|
|||||||
class RsServiceControlItem: public RsItem
|
class RsServiceControlItem: public RsItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RsServiceControlItem(uint8_t item_subtype) : RsItem(RS_PKT_VERSION_SERVICE,RS_SERVICE_TYPE_SERVICE_CONTROL,item_subtype) {}
|
explicit RsServiceControlItem(uint8_t item_subtype) : RsItem(RS_PKT_VERSION_SERVICE,RS_SERVICE_TYPE_SERVICE_CONTROL,item_subtype) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class RsServicePermissionItem: public RsServiceControlItem, public RsServicePermissions
|
class RsServicePermissionItem: public RsServiceControlItem, public RsServicePermissions
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RsServicePermissionItem(): RsServiceControlItem(RS_PKT_SUBTYPE_SERVICE_CONTROL_SERVICE_PERMISSIONS) {}
|
RsServicePermissionItem(): RsServiceControlItem(RS_PKT_SUBTYPE_SERVICE_CONTROL_SERVICE_PERMISSIONS) {}
|
||||||
RsServicePermissionItem(const RsServicePermissions& perms) : RsServiceControlItem(RS_PKT_SUBTYPE_SERVICE_CONTROL_SERVICE_PERMISSIONS), RsServicePermissions(perms) {}
|
explicit RsServicePermissionItem(const RsServicePermissions& perms) : RsServiceControlItem(RS_PKT_SUBTYPE_SERVICE_CONTROL_SERVICE_PERMISSIONS), RsServicePermissions(perms) {}
|
||||||
|
|
||||||
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
virtual void serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||||
{
|
{
|
||||||
RsTypeSerializer::serial_process<uint32_t>(j,ctx,mServiceId,"mServiceId") ;
|
RsTypeSerializer::serial_process<uint32_t>(j,ctx,mServiceId,"mServiceId") ;
|
||||||
RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_NAME,mServiceName,"mServiceName") ;
|
RsTypeSerializer::serial_process (j,ctx,TLV_TYPE_STR_NAME,mServiceName,"mServiceName") ;
|
||||||
RsTypeSerializer::serial_process<bool> (j,ctx,mDefaultAllowed,"mDefaultAllowed") ;
|
RsTypeSerializer::serial_process<bool> (j,ctx,mDefaultAllowed,"mDefaultAllowed") ;
|
||||||
@ -86,9 +86,10 @@ public:
|
|||||||
RsServiceControl *rsServiceControl = NULL;
|
RsServiceControl *rsServiceControl = NULL;
|
||||||
|
|
||||||
p3ServiceControl::p3ServiceControl(p3LinkMgr *linkMgr)
|
p3ServiceControl::p3ServiceControl(p3LinkMgr *linkMgr)
|
||||||
:RsServiceControl(), p3Config(),
|
: RsServiceControl(), p3Config(),
|
||||||
mLinkMgr(linkMgr), mOwnPeerId(linkMgr->getOwnId()),
|
mLinkMgr(linkMgr), mOwnPeerId(linkMgr->getOwnId()),
|
||||||
mCtrlMtx("p3ServiceControl"), mMonitorMtx("P3ServiceControl::Monitor")
|
mCtrlMtx("p3ServiceControl"), mMonitorMtx("P3ServiceControl::Monitor"),
|
||||||
|
mServiceServer(NULL)
|
||||||
{
|
{
|
||||||
mSerialiser = new ServiceControlSerialiser ;
|
mSerialiser = new ServiceControlSerialiser ;
|
||||||
}
|
}
|
||||||
@ -356,7 +357,7 @@ bool p3ServiceControl::getServicePermissions(uint32_t serviceId, RsServicePermis
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3ServiceControl::createDefaultPermissions_locked(uint32_t serviceId, std::string serviceName, bool defaultOn)
|
bool p3ServiceControl::createDefaultPermissions_locked(uint32_t serviceId, const std::string& serviceName, bool defaultOn)
|
||||||
{
|
{
|
||||||
std::map<uint32_t, RsServicePermissions>::iterator it;
|
std::map<uint32_t, RsServicePermissions>::iterator it;
|
||||||
it = mServicePermissionMap.find(serviceId);
|
it = mServicePermissionMap.find(serviceId);
|
||||||
@ -780,7 +781,7 @@ void p3ServiceControl::recordFilterChanges_locked(const RsPeerId &peerId,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* find differences */
|
/* find differences */
|
||||||
std::map<uint32_t, bool> changes;
|
//std::map<uint32_t, bool> changes;
|
||||||
std::set<uint32_t>::const_iterator it1, it2, eit1, eit2;
|
std::set<uint32_t>::const_iterator it1, it2, eit1, eit2;
|
||||||
it1 = originalFilter.mAllowedServices.begin();
|
it1 = originalFilter.mAllowedServices.begin();
|
||||||
eit1 = originalFilter.mAllowedServices.end();
|
eit1 = originalFilter.mAllowedServices.end();
|
||||||
@ -796,7 +797,7 @@ void p3ServiceControl::recordFilterChanges_locked(const RsPeerId &peerId,
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
// removal
|
// removal
|
||||||
changes[*it1] = false;
|
//changes[*it1] = false;
|
||||||
filterChangeRemoved_locked(peerId, *it1);
|
filterChangeRemoved_locked(peerId, *it1);
|
||||||
++it1;
|
++it1;
|
||||||
}
|
}
|
||||||
@ -808,7 +809,7 @@ void p3ServiceControl::recordFilterChanges_locked(const RsPeerId &peerId,
|
|||||||
#endif
|
#endif
|
||||||
// addition.
|
// addition.
|
||||||
filterChangeAdded_locked(peerId, *it2);
|
filterChangeAdded_locked(peerId, *it2);
|
||||||
changes[*it2] = true;
|
//changes[*it2] = true;
|
||||||
++it2;
|
++it2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -826,7 +827,7 @@ void p3ServiceControl::recordFilterChanges_locked(const RsPeerId &peerId,
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
// removal
|
// removal
|
||||||
changes[*it1] = false;
|
//changes[*it1] = false;
|
||||||
filterChangeRemoved_locked(peerId, *it1);
|
filterChangeRemoved_locked(peerId, *it1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -837,7 +838,7 @@ void p3ServiceControl::recordFilterChanges_locked(const RsPeerId &peerId,
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
// addition.
|
// addition.
|
||||||
changes[*it2] = true;
|
//changes[*it2] = true;
|
||||||
filterChangeAdded_locked(peerId, *it2);
|
filterChangeAdded_locked(peerId, *it2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -938,7 +939,7 @@ void p3ServiceControl::filterChangeRemoved_locked(const RsPeerId &peerId, uint32
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::map<uint32_t, std::set<RsPeerId> >::iterator mit;
|
//std::map<uint32_t, std::set<RsPeerId> >::iterator mit;
|
||||||
|
|
||||||
std::set<RsPeerId> &peerSet = mServicePeerMap[serviceId];
|
std::set<RsPeerId> &peerSet = mServicePeerMap[serviceId];
|
||||||
std::set<RsPeerId>::iterator sit;
|
std::set<RsPeerId>::iterator sit;
|
||||||
@ -969,7 +970,7 @@ void p3ServiceControl::filterChangeAdded_locked(const RsPeerId &peerId, uint32_t
|
|||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::map<uint32_t, std::set<RsPeerId> >::iterator mit;
|
//std::map<uint32_t, std::set<RsPeerId> >::iterator mit;
|
||||||
|
|
||||||
std::set<RsPeerId> &peerSet = mServicePeerMap[serviceId];
|
std::set<RsPeerId> &peerSet = mServicePeerMap[serviceId];
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
p3ServiceControl(p3LinkMgr *linkMgr);
|
explicit p3ServiceControl(p3LinkMgr *linkMgr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* checks and update all added configurations
|
* checks and update all added configurations
|
||||||
@ -171,7 +171,7 @@ bool updateFilterByPeer_locked(const RsPeerId &peerId);
|
|||||||
void filterChangeAdded_locked(const RsPeerId &peerId, uint32_t serviceId);
|
void filterChangeAdded_locked(const RsPeerId &peerId, uint32_t serviceId);
|
||||||
void filterChangeRemoved_locked(const RsPeerId &peerId, uint32_t serviceId);
|
void filterChangeRemoved_locked(const RsPeerId &peerId, uint32_t serviceId);
|
||||||
|
|
||||||
bool createDefaultPermissions_locked(uint32_t serviceId, std::string serviceName, bool defaultOn);
|
bool createDefaultPermissions_locked(uint32_t serviceId, const std::string& serviceName, bool defaultOn);
|
||||||
bool peerHasPermissionForService_locked(const RsPeerId &peerId, uint32_t serviceId);
|
bool peerHasPermissionForService_locked(const RsPeerId &peerId, uint32_t serviceId);
|
||||||
|
|
||||||
p3LinkMgr *mLinkMgr;
|
p3LinkMgr *mLinkMgr;
|
||||||
|
Loading…
Reference in New Issue
Block a user