mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-12 16:21:13 +00:00
Fix compiler warnings.
Initialize all data members in initializer lists. Reorder data members in initializer list to have the same order as in the class declaration. Comment or remove unused parameters and unused variables. Convert all old style casts to the correct and explicit c++ cast like const_cast, static_cast, dynamic_cast or reinterpret_cast. In most cases static_cast is used.
This commit is contained in:
parent
bb36147099
commit
fa7040fe65
|
@ -24,13 +24,13 @@ using namespace std;
|
||||||
boost::mutex FairMQChannel::fChannelMutex;
|
boost::mutex FairMQChannel::fChannelMutex;
|
||||||
|
|
||||||
FairMQChannel::FairMQChannel()
|
FairMQChannel::FairMQChannel()
|
||||||
: fType("unspecified")
|
: fSocket(nullptr)
|
||||||
|
, fType("unspecified")
|
||||||
, fMethod("unspecified")
|
, fMethod("unspecified")
|
||||||
, fAddress("unspecified")
|
, fAddress("unspecified")
|
||||||
, fSndBufSize(1000)
|
, fSndBufSize(1000)
|
||||||
, fRcvBufSize(1000)
|
, fRcvBufSize(1000)
|
||||||
, fRateLogging(1)
|
, fRateLogging(1)
|
||||||
, fSocket(nullptr)
|
|
||||||
, fChannelName("")
|
, fChannelName("")
|
||||||
, fIsValid(false)
|
, fIsValid(false)
|
||||||
, fPoller(nullptr)
|
, fPoller(nullptr)
|
||||||
|
@ -44,13 +44,13 @@ FairMQChannel::FairMQChannel()
|
||||||
}
|
}
|
||||||
|
|
||||||
FairMQChannel::FairMQChannel(const string& type, const string& method, const string& address)
|
FairMQChannel::FairMQChannel(const string& type, const string& method, const string& address)
|
||||||
: fType(type)
|
: fSocket(nullptr)
|
||||||
|
, fType(type)
|
||||||
, fMethod(method)
|
, fMethod(method)
|
||||||
, fAddress(address)
|
, fAddress(address)
|
||||||
, fSndBufSize(1000)
|
, fSndBufSize(1000)
|
||||||
, fRcvBufSize(1000)
|
, fRcvBufSize(1000)
|
||||||
, fRateLogging(1)
|
, fRateLogging(1)
|
||||||
, fSocket(nullptr)
|
|
||||||
, fChannelName("")
|
, fChannelName("")
|
||||||
, fIsValid(false)
|
, fIsValid(false)
|
||||||
, fPoller(nullptr)
|
, fPoller(nullptr)
|
||||||
|
@ -64,13 +64,13 @@ FairMQChannel::FairMQChannel(const string& type, const string& method, const str
|
||||||
}
|
}
|
||||||
|
|
||||||
FairMQChannel::FairMQChannel(const FairMQChannel& chan)
|
FairMQChannel::FairMQChannel(const FairMQChannel& chan)
|
||||||
: fType(chan.fType)
|
: fSocket(nullptr)
|
||||||
|
, fType(chan.fType)
|
||||||
, fMethod(chan.fMethod)
|
, fMethod(chan.fMethod)
|
||||||
, fAddress(chan.fAddress)
|
, fAddress(chan.fAddress)
|
||||||
, fSndBufSize(chan.fSndBufSize)
|
, fSndBufSize(chan.fSndBufSize)
|
||||||
, fRcvBufSize(chan.fRcvBufSize)
|
, fRcvBufSize(chan.fRcvBufSize)
|
||||||
, fRateLogging(chan.fRateLogging)
|
, fRateLogging(chan.fRateLogging)
|
||||||
, fSocket(nullptr)
|
|
||||||
, fChannelName(chan.fChannelName)
|
, fChannelName(chan.fChannelName)
|
||||||
, fIsValid(false)
|
, fIsValid(false)
|
||||||
, fPoller(nullptr)
|
, fPoller(nullptr)
|
||||||
|
|
|
@ -225,7 +225,7 @@ bool FairMQDevice::InitChannel(FairMQChannel& ch)
|
||||||
|
|
||||||
size_t pos = ch.fAddress.rfind(":");
|
size_t pos = ch.fAddress.rfind(":");
|
||||||
stringstream newPort;
|
stringstream newPort;
|
||||||
newPort << (int)randomPort(gen);
|
newPort << static_cast<int>(randomPort(gen));
|
||||||
ch.fAddress = ch.fAddress.substr(0, pos + 1) + newPort.str();
|
ch.fAddress = ch.fAddress.substr(0, pos + 1) + newPort.str();
|
||||||
|
|
||||||
LOG(DEBUG) << "Binding channel " << ch.fChannelName << " on " << ch.fAddress;
|
LOG(DEBUG) << "Binding channel " << ch.fChannelName << " on " << ch.fAddress;
|
||||||
|
@ -559,19 +559,19 @@ void FairMQDevice::LogSocketRates()
|
||||||
for (auto itr = filteredSockets.begin(); itr != filteredSockets.end(); itr++)
|
for (auto itr = filteredSockets.begin(); itr != filteredSockets.end(); itr++)
|
||||||
{
|
{
|
||||||
bytesInNew.at(i) = (*itr)->GetBytesRx();
|
bytesInNew.at(i) = (*itr)->GetBytesRx();
|
||||||
mbPerSecIn.at(i) = ((double)(bytesInNew.at(i) - bytesIn.at(i)) / (1024. * 1024.)) / (double)msSinceLastLog * 1000.;
|
mbPerSecIn.at(i) = (static_cast<double>(bytesInNew.at(i) - bytesIn.at(i)) / (1024. * 1024.)) / static_cast<double>(msSinceLastLog) * 1000.;
|
||||||
bytesIn.at(i) = bytesInNew.at(i);
|
bytesIn.at(i) = bytesInNew.at(i);
|
||||||
|
|
||||||
msgInNew.at(i) = (*itr)->GetMessagesRx();
|
msgInNew.at(i) = (*itr)->GetMessagesRx();
|
||||||
msgPerSecIn.at(i) = (double)(msgInNew.at(i) - msgIn.at(i)) / (double)msSinceLastLog * 1000.;
|
msgPerSecIn.at(i) = static_cast<double>(msgInNew.at(i) - msgIn.at(i)) / static_cast<double>(msSinceLastLog) * 1000.;
|
||||||
msgIn.at(i) = msgInNew.at(i);
|
msgIn.at(i) = msgInNew.at(i);
|
||||||
|
|
||||||
bytesOutNew.at(i) = (*itr)->GetBytesTx();
|
bytesOutNew.at(i) = (*itr)->GetBytesTx();
|
||||||
mbPerSecOut.at(i) = ((double)(bytesOutNew.at(i) - bytesOut.at(i)) / (1024. * 1024.)) / (double)msSinceLastLog * 1000.;
|
mbPerSecOut.at(i) = (static_cast<double>(bytesOutNew.at(i) - bytesOut.at(i)) / (1024. * 1024.)) / static_cast<double>(msSinceLastLog) * 1000.;
|
||||||
bytesOut.at(i) = bytesOutNew.at(i);
|
bytesOut.at(i) = bytesOutNew.at(i);
|
||||||
|
|
||||||
msgOutNew.at(i) = (*itr)->GetMessagesTx();
|
msgOutNew.at(i) = (*itr)->GetMessagesTx();
|
||||||
msgPerSecOut.at(i) = (double)(msgOutNew.at(i) - msgOut.at(i)) / (double)msSinceLastLog * 1000.;
|
msgPerSecOut.at(i) = static_cast<double>(msgOutNew.at(i) - msgOut.at(i)) / static_cast<double>(msSinceLastLog) * 1000.;
|
||||||
msgOut.at(i) = msgOutNew.at(i);
|
msgOut.at(i) = msgOutNew.at(i);
|
||||||
|
|
||||||
LOG(DEBUG) << filteredChannelNames.at(i) << ": "
|
LOG(DEBUG) << filteredChannelNames.at(i) << ": "
|
||||||
|
|
|
@ -20,5 +20,5 @@ timestamp_t get_timestamp()
|
||||||
{
|
{
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
gettimeofday(&now, NULL);
|
gettimeofday(&now, NULL);
|
||||||
return now.tv_usec + (timestamp_t)now.tv_sec * 1000000;
|
return now.tv_usec + static_cast<timestamp_t>(now.tv_sec) * 1000000;
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,7 @@ class base_GenericSampler : public FairMQDevice, public T, public U
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename S = source_type,FairMQ::tools::enable_if_hasNot_GetHeader<S> = 0>
|
template<typename S = source_type,FairMQ::tools::enable_if_hasNot_GetHeader<S> = 0>
|
||||||
void SendHeader(int socketIdx) {}
|
void SendHeader(int /*socketIdx*/) {}
|
||||||
template<typename S = source_type,FairMQ::tools::enable_if_has_GetHeader<S> = 0>
|
template<typename S = source_type,FairMQ::tools::enable_if_has_GetHeader<S> = 0>
|
||||||
void SendHeader(int socketIdx)
|
void SendHeader(int socketIdx)
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,7 +81,7 @@ FairMQPollerNN::FairMQPollerNN(const unordered_map<string, vector<FairMQChannel>
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (string channel : channelList)
|
for (string channel : channelList)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < channelsMap.at(channel).size(); ++i)
|
for (unsigned int i = 0; i < channelsMap.at(channel).size(); ++i)
|
||||||
{
|
{
|
||||||
index = fOffsetMap[channel] + i;
|
index = fOffsetMap[channel] + i;
|
||||||
items[index].fd = channelsMap.at(channel).at(i).fSocket->GetSocket(1);
|
items[index].fd = channelsMap.at(channel).at(i).fSocket->GetSocket(1);
|
||||||
|
|
|
@ -208,7 +208,7 @@ void* FairMQSocketNN::GetSocket() const
|
||||||
return NULL; // dummy method to comply with the interface. functionality not possible in zeromq.
|
return NULL; // dummy method to comply with the interface. functionality not possible in zeromq.
|
||||||
}
|
}
|
||||||
|
|
||||||
int FairMQSocketNN::GetSocket(int nothing) const
|
int FairMQSocketNN::GetSocket(int /*nothing*/) const
|
||||||
{
|
{
|
||||||
return fSocket;
|
return fSocket;
|
||||||
}
|
}
|
||||||
|
@ -250,7 +250,7 @@ unsigned long FairMQSocketNN::GetMessagesRx() const
|
||||||
return fMessagesRx;
|
return fMessagesRx;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FairMQSocketNN::SetSendTimeout(const int timeout, const string& address, const string& method)
|
bool FairMQSocketNN::SetSendTimeout(const int timeout, const string& /*address*/, const string& /*method*/)
|
||||||
{
|
{
|
||||||
if (nn_setsockopt(fSocket, NN_SOL_SOCKET, NN_SNDTIMEO, &timeout, sizeof(int)) != 0)
|
if (nn_setsockopt(fSocket, NN_SOL_SOCKET, NN_SNDTIMEO, &timeout, sizeof(int)) != 0)
|
||||||
{
|
{
|
||||||
|
@ -274,7 +274,7 @@ int FairMQSocketNN::GetSendTimeout() const
|
||||||
return timeout;
|
return timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FairMQSocketNN::SetReceiveTimeout(const int timeout, const string& address, const string& method)
|
bool FairMQSocketNN::SetReceiveTimeout(const int timeout, const string& /*address*/, const string& /*method*/)
|
||||||
{
|
{
|
||||||
if (nn_setsockopt(fSocket, NN_SOL_SOCKET, NN_RCVTIMEO, &timeout, sizeof(int)) != 0)
|
if (nn_setsockopt(fSocket, NN_SOL_SOCKET, NN_RCVTIMEO, &timeout, sizeof(int)) != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -196,4 +196,4 @@ FairMQMap XML::UserParser(stringstream& input, const string& deviceId, const str
|
||||||
return ptreeToMQMap(pt, deviceId, rootNode, "xml");
|
return ptreeToMQMap(pt, deviceId, rootNode, "xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end FairMQParser namespace
|
} // end FairMQParser namespace
|
||||||
|
|
|
@ -20,8 +20,8 @@ using namespace std;
|
||||||
FairMQProgOptions::FairMQProgOptions()
|
FairMQProgOptions::FairMQProgOptions()
|
||||||
: FairProgOptions()
|
: FairProgOptions()
|
||||||
, fMQParserOptions("MQ-Device parser options")
|
, fMQParserOptions("MQ-Device parser options")
|
||||||
, fMQOptionsInCmd("MQ-Device options")
|
|
||||||
, fMQOptionsInCfg("MQ-Device options")
|
, fMQOptionsInCfg("MQ-Device options")
|
||||||
|
, fMQOptionsInCmd("MQ-Device options")
|
||||||
, fMQtree()
|
, fMQtree()
|
||||||
, fFairMQMap()
|
, fFairMQMap()
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,18 +19,18 @@ using namespace std;
|
||||||
/// //////////////////////////////////////////////////////////////////////////////////////////////////////
|
/// //////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// Constructor
|
/// Constructor
|
||||||
FairProgOptions::FairProgOptions() :
|
FairProgOptions::FairProgOptions() :
|
||||||
|
fVarMap(),
|
||||||
fGenericDesc("Generic options description"),
|
fGenericDesc("Generic options description"),
|
||||||
fConfigDesc("Configuration options description"),
|
fConfigDesc("Configuration options description"),
|
||||||
fHiddenDesc("Hidden options description"),
|
|
||||||
fEnvironmentDesc("Environment variables"),
|
fEnvironmentDesc("Environment variables"),
|
||||||
|
fHiddenDesc("Hidden options description"),
|
||||||
fCmdLineOptions("Command line options"),
|
fCmdLineOptions("Command line options"),
|
||||||
fConfigFileOptions("Configuration file options"),
|
fConfigFileOptions("Configuration file options"),
|
||||||
|
fSeverityMap(),
|
||||||
fVisibleOptions("Visible options"),
|
fVisibleOptions("Visible options"),
|
||||||
fVerboseLvl("INFO"),
|
fVerboseLvl("INFO"),
|
||||||
fUseConfigFile(false),
|
fUseConfigFile(false),
|
||||||
fConfigFile(),
|
fConfigFile()
|
||||||
fVarMap(),
|
|
||||||
fSeverityMap()
|
|
||||||
{
|
{
|
||||||
fGenericDesc.add_options()
|
fGenericDesc.add_options()
|
||||||
("help,h", "produce help")
|
("help,h", "produce help")
|
||||||
|
|
|
@ -71,4 +71,4 @@ namespace FairMQParser
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // end FairMQParser namespace
|
} // end FairMQParser namespace
|
||||||
|
|
|
@ -49,7 +49,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
string filename = config.GetValue<string>("config-json-file");
|
string filename = config.GetValue<string>("config-json-file");
|
||||||
string id = config.GetValue<string>("id");
|
string id = config.GetValue<string>("id");
|
||||||
int ioThreads = config.GetValue<int>("io-threads");
|
// int ioThreads = config.GetValue<int>("io-threads");
|
||||||
|
|
||||||
config.UserParser<JSON>(filename, id);
|
config.UserParser<JSON>(filename, id);
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
splitter.fChannels["data-in"].push_back(inputChannel);
|
splitter.fChannels["data-in"].push_back(inputChannel);
|
||||||
|
|
||||||
for (int i = 0; i < options.outputAddress.size(); ++i)
|
for (unsigned int i = 0; i < options.outputAddress.size(); ++i)
|
||||||
{
|
{
|
||||||
FairMQChannel outputChannel(options.outputSocketType.at(i), options.outputMethod.at(i), options.outputAddress.at(i));
|
FairMQChannel outputChannel(options.outputSocketType.at(i), options.outputMethod.at(i), options.outputAddress.at(i));
|
||||||
outputChannel.UpdateSndBufSize(options.outputBufSize.at(i));
|
outputChannel.UpdateSndBufSize(options.outputBufSize.at(i));
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "FairMQLogger.h"
|
#include "FairMQLogger.h"
|
||||||
#include "FairMQTestPub.h"
|
#include "FairMQTestPub.h"
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int /*argc*/, char** /*argv*/)
|
||||||
{
|
{
|
||||||
FairMQTestPub testPub;
|
FairMQTestPub testPub;
|
||||||
testPub.CatchSignals();
|
testPub.CatchSignals();
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "FairMQLogger.h"
|
#include "FairMQLogger.h"
|
||||||
#include "FairMQTestSub.h"
|
#include "FairMQTestSub.h"
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int /*argc*/, char** /*argv*/)
|
||||||
{
|
{
|
||||||
FairMQTestSub testSub;
|
FairMQTestSub testSub;
|
||||||
testSub.CatchSignals();
|
testSub.CatchSignals();
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "FairMQLogger.h"
|
#include "FairMQLogger.h"
|
||||||
#include "FairMQTestPull.h"
|
#include "FairMQTestPull.h"
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int /*argc*/, char** /*argv*/)
|
||||||
{
|
{
|
||||||
FairMQTestPull testPull;
|
FairMQTestPull testPull;
|
||||||
testPull.CatchSignals();
|
testPull.CatchSignals();
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "FairMQLogger.h"
|
#include "FairMQLogger.h"
|
||||||
#include "FairMQTestPush.h"
|
#include "FairMQTestPush.h"
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int /*argc*/, char** /*argv*/)
|
||||||
{
|
{
|
||||||
FairMQTestPush testPush;
|
FairMQTestPush testPush;
|
||||||
testPush.CatchSignals();
|
testPush.CatchSignals();
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "FairMQLogger.h"
|
#include "FairMQLogger.h"
|
||||||
#include "FairMQTestRep.h"
|
#include "FairMQTestRep.h"
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int /*argc*/, char** /*argv*/)
|
||||||
{
|
{
|
||||||
FairMQTestRep testRep;
|
FairMQTestRep testRep;
|
||||||
testRep.CatchSignals();
|
testRep.CatchSignals();
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "FairMQLogger.h"
|
#include "FairMQLogger.h"
|
||||||
#include "FairMQTestReq.h"
|
#include "FairMQTestReq.h"
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int /*argc*/, char** /*argv*/)
|
||||||
{
|
{
|
||||||
FairMQTestReq testReq;
|
FairMQTestReq testReq;
|
||||||
testReq.CatchSignals();
|
testReq.CatchSignals();
|
||||||
|
|
|
@ -24,8 +24,8 @@ class TransferTimeoutTester : public FairMQDevice
|
||||||
protected:
|
protected:
|
||||||
virtual void Run()
|
virtual void Run()
|
||||||
{
|
{
|
||||||
bool setSndOK = false;
|
// bool setSndOK = false;
|
||||||
bool setRcvOK = false;
|
// bool setRcvOK = false;
|
||||||
bool getSndOK = false;
|
bool getSndOK = false;
|
||||||
bool getRcvOK = false;
|
bool getRcvOK = false;
|
||||||
bool sendCanceling = false;
|
bool sendCanceling = false;
|
||||||
|
@ -87,7 +87,7 @@ class TransferTimeoutTester : public FairMQDevice
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int /*argc*/, char** /*argv*/)
|
||||||
{
|
{
|
||||||
TransferTimeoutTester timeoutTester;
|
TransferTimeoutTester timeoutTester;
|
||||||
timeoutTester.CatchSignals();
|
timeoutTester.CatchSignals();
|
||||||
|
|
|
@ -99,7 +99,7 @@ void FairMQMessageZMQ::Copy(FairMQMessage* msg)
|
||||||
// DEPRECATED: Use Copy(const unique_ptr<FairMQMessage>&)
|
// DEPRECATED: Use Copy(const unique_ptr<FairMQMessage>&)
|
||||||
|
|
||||||
// Shares the message buffer between msg and this fMessage.
|
// Shares the message buffer between msg and this fMessage.
|
||||||
if (zmq_msg_copy(&fMessage, (zmq_msg_t*)msg->GetMessage()) != 0)
|
if (zmq_msg_copy(&fMessage, static_cast<zmq_msg_t*>(msg->GetMessage())) != 0)
|
||||||
{
|
{
|
||||||
LOG(ERROR) << "failed copying message, reason: " << zmq_strerror(errno);
|
LOG(ERROR) << "failed copying message, reason: " << zmq_strerror(errno);
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ void FairMQMessageZMQ::Copy(FairMQMessage* msg)
|
||||||
void FairMQMessageZMQ::Copy(const unique_ptr<FairMQMessage>& msg)
|
void FairMQMessageZMQ::Copy(const unique_ptr<FairMQMessage>& msg)
|
||||||
{
|
{
|
||||||
// Shares the message buffer between msg and this fMessage.
|
// Shares the message buffer between msg and this fMessage.
|
||||||
if (zmq_msg_copy(&fMessage, (zmq_msg_t*)msg->GetMessage()) != 0)
|
if (zmq_msg_copy(&fMessage, static_cast<zmq_msg_t*>(msg->GetMessage())) != 0)
|
||||||
{
|
{
|
||||||
LOG(ERROR) << "failed copying message, reason: " << zmq_strerror(errno);
|
LOG(ERROR) << "failed copying message, reason: " << zmq_strerror(errno);
|
||||||
}
|
}
|
||||||
|
@ -147,4 +147,4 @@ FairMQMessageZMQ::~FairMQMessageZMQ()
|
||||||
{
|
{
|
||||||
LOG(ERROR) << "failed closing message with data, reason: " << zmq_strerror(errno);
|
LOG(ERROR) << "failed closing message with data, reason: " << zmq_strerror(errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user