Apply cppcoreguidelines-init-variables

This commit is contained in:
Alexey Rybalchenko 2021-05-26 12:44:04 +02:00 committed by Dennis Klein
parent 904771e9fa
commit ccbd622130
8 changed files with 14 additions and 14 deletions

View File

@ -147,7 +147,7 @@ auto Control::InteractiveMode() -> void
try { try {
RunStartupSequence(); RunStartupSequence();
char input; // hold the user console input char input = 0; // hold the user console input
pollfd cinfd[1]; pollfd cinfd[1];
cinfd[0].fd = fileno(stdin); cinfd[0].fd = fileno(stdin);
cinfd[0].events = POLLIN; cinfd[0].events = POLLIN;

View File

@ -390,7 +390,7 @@ void Cmds::Deserialize(const string& str, const Format type)
{ {
fCmds.clear(); fCmds.clear();
const flatbuffers::Vector<flatbuffers::Offset<FBCommand>>* cmds; const flatbuffers::Vector<flatbuffers::Offset<FBCommand>>* cmds = nullptr;
if (type == Format::Binary) { if (type == Format::Binary) {
cmds = cmd::GetFBCommands(const_cast<char*>(str.c_str()))->commands(); cmds = cmd::GetFBCommands(const_cast<char*>(str.c_str()))->commands();

View File

@ -156,7 +156,7 @@ void sendCommand(const string& commandIn, const string& path, unsigned int timeo
return; return;
} }
char c; char c = 0;
string command; string command;
TerminalConfig tconfig; TerminalConfig tconfig;
@ -185,7 +185,7 @@ try {
string targetState; string targetState;
string pKey; string pKey;
string pVal; string pVal;
unsigned int timeout; unsigned int timeout = 0;
fair::Logger::SetConsoleSeverity("debug"); fair::Logger::SetConsoleSeverity("debug");
fair::Logger::SetConsoleColor(true); fair::Logger::SetConsoleColor(true);

View File

@ -313,8 +313,8 @@ void Monitor::ReceiveHeartbeats()
try { try {
bipc::message_queue mq(bipc::open_or_create, fControlQueueName.c_str(), 1000, 256); bipc::message_queue mq(bipc::open_or_create, fControlQueueName.c_str(), 1000, 256);
unsigned int priority; unsigned int priority = 0;
bipc::message_queue::size_type recvdSize; bipc::message_queue::size_type recvdSize = 0;
char msg[256] = {0}; char msg[256] = {0};
while (!fTerminating) { while (!fTerminating) {
@ -337,7 +337,7 @@ void Monitor::ReceiveHeartbeats()
void Monitor::Interactive() void Monitor::Interactive()
{ {
char c; char c = 0;
pollfd cinfd[1]; pollfd cinfd[1];
cinfd[0].fd = fileno(stdin); cinfd[0].fd = fileno(stdin);
cinfd[0].events = POLLIN; cinfd[0].events = POLLIN;

View File

@ -179,8 +179,8 @@ struct Region
} }
void ReceiveAcks() void ReceiveAcks()
{ {
unsigned int priority; unsigned int priority = 0;
boost::interprocess::message_queue::size_type recvdSize; boost::interprocess::message_queue::size_type recvdSize = 0;
std::unique_ptr<RegionBlock[]> blocks = std::make_unique<RegionBlock[]>(fAckBunchSize); std::unique_ptr<RegionBlock[]> blocks = std::make_unique<RegionBlock[]>(fAckBunchSize);
std::vector<fair::mq::RegionBlock> result; std::vector<fair::mq::RegionBlock> result;
result.reserve(fAckBunchSize); result.reserve(fAckBunchSize);

View File

@ -41,7 +41,7 @@ class TransportFactory final : public fair::mq::TransportFactory
, fZmqCtx(zmq_ctx_new()) , fZmqCtx(zmq_ctx_new())
, fManager(nullptr) , fManager(nullptr)
{ {
int major, minor, patch; int major = 0, minor = 0, patch = 0;
zmq_version(&major, &minor, &patch); zmq_version(&major, &minor, &patch);
LOG(debug) << "Transport: Using ZeroMQ (" << major << "." << minor << "." << patch << ") & " LOG(debug) << "Transport: Using ZeroMQ (" << major << "." << minor << "." << patch << ") & "
<< "boost::interprocess (" << (BOOST_VERSION / 100000) << "." << (BOOST_VERSION / 100 % 1000) << "." << (BOOST_VERSION % 100) << ")"; << "boost::interprocess (" << (BOOST_VERSION / 100000) << "." << (BOOST_VERSION / 100 % 1000) << "." << (BOOST_VERSION % 100) << ")";

View File

@ -40,9 +40,9 @@ namespace fair::mq::tools
map<string, string> getHostIPs() map<string, string> getHostIPs()
{ {
map<string, string> addressMap; map<string, string> addressMap;
ifaddrs* ifaddr; ifaddrs* ifaddr = nullptr;
ifaddrs* ifa; ifaddrs* ifa = nullptr;
int s; int s = 0;
array<char, NI_MAXHOST> host{}; array<char, NI_MAXHOST> host{};
if (getifaddrs(&ifaddr) == -1) { if (getifaddrs(&ifaddr) == -1) {

View File

@ -31,7 +31,7 @@ class TransportFactory final : public FairMQTransportFactory
: FairMQTransportFactory(id) : FairMQTransportFactory(id)
, fCtx(nullptr) , fCtx(nullptr)
{ {
int major, minor, patch; int major = 0, minor = 0, patch = 0;
zmq_version(&major, &minor, &patch); zmq_version(&major, &minor, &patch);
LOG(debug) << "Transport: Using ZeroMQ library, version: " << major << "." << minor << "." << patch; LOG(debug) << "Transport: Using ZeroMQ library, version: " << major << "." << minor << "." << patch;