Fix issues found by Codacy

This commit is contained in:
Alexey Rybalchenko
2018-10-08 12:42:35 +02:00
committed by Dennis Klein
parent 985150437a
commit e1f555bc05
25 changed files with 53 additions and 73 deletions

View File

@@ -68,10 +68,9 @@ FairMQPollerNN::FairMQPollerNN(const unordered_map<string, vector<FairMQChannel>
, fNumItems(0)
, fOffsetMap()
{
int offset = 0;
try
{
int offset = 0;
// calculate offsets and the total size of the poll item set
for (string channel : channelList)
{
@@ -184,7 +183,7 @@ bool FairMQPollerNN::CheckOutput(const int index)
return false;
}
bool FairMQPollerNN::CheckInput(const string channelKey, const int index)
bool FairMQPollerNN::CheckInput(const string& channelKey, const int index)
{
try
{
@@ -203,7 +202,7 @@ bool FairMQPollerNN::CheckInput(const string channelKey, const int index)
}
}
bool FairMQPollerNN::CheckOutput(const string channelKey, const int index)
bool FairMQPollerNN::CheckOutput(const string& channelKey, const int index)
{
try
{

View File

@@ -44,8 +44,8 @@ class FairMQPollerNN : public FairMQPoller
virtual void Poll(const int timeout);
virtual bool CheckInput(const int index);
virtual bool CheckOutput(const int index);
virtual bool CheckInput(const std::string channelKey, const int index);
virtual bool CheckOutput(const std::string channelKey, const int index);
virtual bool CheckInput(const std::string& channelKey, const int index);
virtual bool CheckOutput(const std::string& channelKey, const int index);
virtual ~FairMQPollerNN();

View File

@@ -197,7 +197,6 @@ int FairMQSocketNN::SendImpl(FairMQMessagePtr& msg, const int flags, const int t
int FairMQSocketNN::ReceiveImpl(FairMQMessagePtr& msg, const int flags, const int timeout)
{
int nbytes = -1;
int elapsed = 0;
FairMQMessageNN* msgPtr = static_cast<FairMQMessageNN*>(msg.get());
@@ -205,7 +204,7 @@ int FairMQSocketNN::ReceiveImpl(FairMQMessagePtr& msg, const int flags, const in
while (true)
{
void* ptr = nullptr;
nbytes = nn_recv(fSocket, &ptr, NN_MSG, flags);
int nbytes = nn_recv(fSocket, &ptr, NN_MSG, flags);
if (nbytes >= 0)
{
fBytesRx += nbytes;
@@ -279,11 +278,9 @@ int64_t FairMQSocketNN::SendImpl(vector<FairMQMessagePtr>& msgVec, const int fla
}
}
int64_t nbytes = -1;
while (true)
{
nbytes = nn_send(fSocket, sbuf.data(), sbuf.size(), flags);
int64_t nbytes = nn_send(fSocket, sbuf.data(), sbuf.size(), flags);
if (nbytes >= 0)
{
fBytesTx += nbytes;