Fixed cppcheck errors

pull/297/head
SChernykh 4 months ago
parent bc36be1e58
commit f98d2e652a

@ -249,6 +249,7 @@ template<> struct Stream::Entry<hash>
buf[i * 2 + 0] = "0123456789abcdef"[data.h[i] >> 4];
buf[i * 2 + 1] = "0123456789abcdef"[data.h[i] & 15];
}
// cppcheck-suppress uninitvar
wrapper->writeBuf(buf, sizeof(buf));
}
};
@ -458,6 +459,7 @@ struct log::Stream::Entry<PadRight<T>>
static NOINLINE void put(PadRight<T>&& data, Stream* wrapper)
{
char buf[log::Stream::BUF_SIZE + 1];
// cppcheck-suppress uninitvar
log::Stream s(buf);
s << data.m_value;

@ -1393,6 +1393,7 @@ void p2pool::api_update_stats_mod()
}
char last_block_found_buf[log::Stream::BUF_SIZE + 1];
// cppcheck-suppress uninitvar
log::Stream s(last_block_found_buf);
s << last_block_found_hash << '\0';
memcpy(last_block_found_buf + 4, "...", 4);

@ -100,6 +100,7 @@ SideChain::SideChain(p2pool* pool, NetworkType type, const char* pool_name)
LOGINFO(1, "generating consensus ID");
char buf[log::Stream::BUF_SIZE + 1];
// cppcheck-suppress uninitvar
log::Stream s(buf);
s << s_networkType << '\0'

@ -213,6 +213,7 @@ NOINLINE bool difficulty_type::check_pow(const hash& pow_hash) const
std::ostream& operator<<(std::ostream& s, const difficulty_type& d)
{
char buf[log::Stream::BUF_SIZE + 1];
// cppcheck-suppress uninitvar
log::Stream s1(buf);
s1 << d << '\0';
s << buf;
@ -251,6 +252,7 @@ std::istream& operator>>(std::istream& s, difficulty_type& diff)
std::ostream& operator<<(std::ostream& s, const hash& h)
{
char buf[log::Stream::BUF_SIZE + 1];
// cppcheck-suppress uninitvar
log::Stream s1(buf);
s1 << h << '\0';
s << buf;
@ -401,6 +403,7 @@ struct BackgroundJobTracker::Impl
}
char buf[log::Stream::BUF_SIZE + 1];
// cppcheck-suppress uninitvar
log::Stream s(buf);
for (const auto& job : m_jobs) {
s << '\n' << job.first << " (" << job.second << ')';

@ -210,6 +210,7 @@ bool ZMQReader::connect(const std::string& address, bool keep_monitor)
}
char buf[64];
// cppcheck-suppress uninitvar
log::Stream s(buf);
s << "inproc://p2pool-connect-mon-" << id << '\0';
++id;

Loading…
Cancel
Save