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;
|
||||
|
||||
FairMQChannel::FairMQChannel()
|
||||
: fType("unspecified")
|
||||
: fSocket(nullptr)
|
||||
, fType("unspecified")
|
||||
, fMethod("unspecified")
|
||||
, fAddress("unspecified")
|
||||
, fSndBufSize(1000)
|
||||
, fRcvBufSize(1000)
|
||||
, fRateLogging(1)
|
||||
, fSocket(nullptr)
|
||||
, fChannelName("")
|
||||
, fIsValid(false)
|
||||
, fPoller(nullptr)
|
||||
|
@ -44,13 +44,13 @@ FairMQChannel::FairMQChannel()
|
|||
}
|
||||
|
||||
FairMQChannel::FairMQChannel(const string& type, const string& method, const string& address)
|
||||
: fType(type)
|
||||
: fSocket(nullptr)
|
||||
, fType(type)
|
||||
, fMethod(method)
|
||||
, fAddress(address)
|
||||
, fSndBufSize(1000)
|
||||
, fRcvBufSize(1000)
|
||||
, fRateLogging(1)
|
||||
, fSocket(nullptr)
|
||||
, fChannelName("")
|
||||
, fIsValid(false)
|
||||
, fPoller(nullptr)
|
||||
|
@ -64,13 +64,13 @@ FairMQChannel::FairMQChannel(const string& type, const string& method, const str
|
|||
}
|
||||
|
||||
FairMQChannel::FairMQChannel(const FairMQChannel& chan)
|
||||
: fType(chan.fType)
|
||||
: fSocket(nullptr)
|
||||
, fType(chan.fType)
|
||||
, fMethod(chan.fMethod)
|
||||
, fAddress(chan.fAddress)
|
||||
, fSndBufSize(chan.fSndBufSize)
|
||||
, fRcvBufSize(chan.fRcvBufSize)
|
||||
, fRateLogging(chan.fRateLogging)
|
||||
, fSocket(nullptr)
|
||||
, fChannelName(chan.fChannelName)
|
||||
, fIsValid(false)
|
||||
, fPoller(nullptr)
|
||||
|
|
|
@ -225,7 +225,7 @@ bool FairMQDevice::InitChannel(FairMQChannel& ch)
|
|||
|
||||
size_t pos = ch.fAddress.rfind(":");
|
||||
stringstream newPort;
|
||||
newPort << (int)randomPort(gen);
|
||||
newPort << static_cast<int>(randomPort(gen));
|
||||
ch.fAddress = ch.fAddress.substr(0, pos + 1) + newPort.str();
|
||||
|
||||
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++)
|
||||
{
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
LOG(DEBUG) << filteredChannelNames.at(i) << ": "
|
||||
|
|
|
@ -20,5 +20,5 @@ timestamp_t get_timestamp()
|
|||
{
|
||||
struct timeval now;
|
||||
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>
|
||||
void SendHeader(int socketIdx) {}
|
||||
void SendHeader(int /*socketIdx*/) {}
|
||||
template<typename S = source_type,FairMQ::tools::enable_if_has_GetHeader<S> = 0>
|
||||
void SendHeader(int socketIdx)
|
||||
{
|
||||
|
|
|
@ -81,7 +81,7 @@ FairMQPollerNN::FairMQPollerNN(const unordered_map<string, vector<FairMQChannel>
|
|||
int index = 0;
|
||||
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;
|
||||
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.
|
||||
}
|
||||
|
||||
int FairMQSocketNN::GetSocket(int nothing) const
|
||||
int FairMQSocketNN::GetSocket(int /*nothing*/) const
|
||||
{
|
||||
return fSocket;
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ unsigned long FairMQSocketNN::GetMessagesRx() const
|
|||
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)
|
||||
{
|
||||
|
@ -274,7 +274,7 @@ int FairMQSocketNN::GetSendTimeout() const
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -20,8 +20,8 @@ using namespace std;
|
|||
FairMQProgOptions::FairMQProgOptions()
|
||||
: FairProgOptions()
|
||||
, fMQParserOptions("MQ-Device parser options")
|
||||
, fMQOptionsInCmd("MQ-Device options")
|
||||
, fMQOptionsInCfg("MQ-Device options")
|
||||
, fMQOptionsInCmd("MQ-Device options")
|
||||
, fMQtree()
|
||||
, fFairMQMap()
|
||||
{
|
||||
|
|
|
@ -19,18 +19,18 @@ using namespace std;
|
|||
/// //////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Constructor
|
||||
FairProgOptions::FairProgOptions() :
|
||||
fVarMap(),
|
||||
fGenericDesc("Generic options description"),
|
||||
fConfigDesc("Configuration options description"),
|
||||
fHiddenDesc("Hidden options description"),
|
||||
fEnvironmentDesc("Environment variables"),
|
||||
fHiddenDesc("Hidden options description"),
|
||||
fCmdLineOptions("Command line options"),
|
||||
fConfigFileOptions("Configuration file options"),
|
||||
fSeverityMap(),
|
||||
fVisibleOptions("Visible options"),
|
||||
fVerboseLvl("INFO"),
|
||||
fUseConfigFile(false),
|
||||
fConfigFile(),
|
||||
fVarMap(),
|
||||
fSeverityMap()
|
||||
fConfigFile()
|
||||
{
|
||||
fGenericDesc.add_options()
|
||||
("help,h", "produce help")
|
||||
|
|
|
@ -49,7 +49,7 @@ int main(int argc, char** argv)
|
|||
|
||||
string filename = config.GetValue<string>("config-json-file");
|
||||
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);
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ int main(int argc, char** argv)
|
|||
|
||||
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));
|
||||
outputChannel.UpdateSndBufSize(options.outputBufSize.at(i));
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "FairMQLogger.h"
|
||||
#include "FairMQTestPub.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
int main(int /*argc*/, char** /*argv*/)
|
||||
{
|
||||
FairMQTestPub testPub;
|
||||
testPub.CatchSignals();
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "FairMQLogger.h"
|
||||
#include "FairMQTestSub.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
int main(int /*argc*/, char** /*argv*/)
|
||||
{
|
||||
FairMQTestSub testSub;
|
||||
testSub.CatchSignals();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "FairMQLogger.h"
|
||||
#include "FairMQTestPull.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
int main(int /*argc*/, char** /*argv*/)
|
||||
{
|
||||
FairMQTestPull testPull;
|
||||
testPull.CatchSignals();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "FairMQLogger.h"
|
||||
#include "FairMQTestPush.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
int main(int /*argc*/, char** /*argv*/)
|
||||
{
|
||||
FairMQTestPush testPush;
|
||||
testPush.CatchSignals();
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "FairMQLogger.h"
|
||||
#include "FairMQTestRep.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
int main(int /*argc*/, char** /*argv*/)
|
||||
{
|
||||
FairMQTestRep testRep;
|
||||
testRep.CatchSignals();
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "FairMQLogger.h"
|
||||
#include "FairMQTestReq.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
int main(int /*argc*/, char** /*argv*/)
|
||||
{
|
||||
FairMQTestReq testReq;
|
||||
testReq.CatchSignals();
|
||||
|
|
|
@ -24,8 +24,8 @@ class TransferTimeoutTester : public FairMQDevice
|
|||
protected:
|
||||
virtual void Run()
|
||||
{
|
||||
bool setSndOK = false;
|
||||
bool setRcvOK = false;
|
||||
// bool setSndOK = false;
|
||||
// bool setRcvOK = false;
|
||||
bool getSndOK = false;
|
||||
bool getRcvOK = 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;
|
||||
timeoutTester.CatchSignals();
|
||||
|
|
|
@ -99,7 +99,7 @@ void FairMQMessageZMQ::Copy(FairMQMessage* msg)
|
|||
// DEPRECATED: Use Copy(const unique_ptr<FairMQMessage>&)
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ void FairMQMessageZMQ::Copy(FairMQMessage* msg)
|
|||
void FairMQMessageZMQ::Copy(const unique_ptr<FairMQMessage>& msg)
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user