mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-10-30 03:27:35 +00:00
Fixed null characters in print_hosts
output
This commit is contained in:
parent
f79be1b343
commit
375bf56e2e
2 changed files with 9 additions and 3 deletions
|
@ -146,7 +146,13 @@ COLOR_ENTRY(LightCyan, "\x1b[0;96m")
|
|||
|
||||
template<size_t N> struct Stream::Entry<char[N]>
|
||||
{
|
||||
static FORCEINLINE void put(const char (&data)[N], Stream* wrapper) { wrapper->writeBuf(data, N - 1); }
|
||||
template<typename T>
|
||||
// cppcheck-suppress constParameterReference
|
||||
static FORCEINLINE void put(T (&data)[N], Stream* wrapper)
|
||||
{
|
||||
static_assert(std::is_same<T, const char>::value, "Non-const char buffer must be cast to \"const char*\"");
|
||||
wrapper->writeBuf(data, N - 1);
|
||||
}
|
||||
};
|
||||
|
||||
template<> struct Stream::Entry<const char*>
|
||||
|
|
|
@ -234,10 +234,10 @@ void p2pool::print_hosts() const
|
|||
}
|
||||
|
||||
if (h.m_displayName == host.m_displayName) {
|
||||
LOGINFO(0, log::LightCyan() << "-> " << h.m_displayName << buf);
|
||||
LOGINFO(0, log::LightCyan() << "-> " << h.m_displayName << static_cast<const char*>(buf));
|
||||
}
|
||||
else {
|
||||
LOGINFO(0, " " << h.m_displayName << buf);
|
||||
LOGINFO(0, " " << h.m_displayName << static_cast<const char*>(buf));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue