mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-12-22 19:39:22 +00:00
clang fixes
This commit is contained in:
parent
133b8dde19
commit
4a5691e349
3 changed files with 7 additions and 19 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
build
|
||||||
|
|
22
src/log.h
22
src/log.h
|
@ -166,6 +166,10 @@ INT_ENTRY(uint16_t)
|
||||||
INT_ENTRY(uint32_t)
|
INT_ENTRY(uint32_t)
|
||||||
INT_ENTRY(uint64_t)
|
INT_ENTRY(uint64_t)
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
INT_ENTRY(unsigned long)
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef INT_ENTRY
|
#undef INT_ENTRY
|
||||||
|
|
||||||
template<typename T, int base>
|
template<typename T, int base>
|
||||||
|
@ -287,24 +291,6 @@ template<> struct log::Stream::Entry<std::string>
|
||||||
static FORCEINLINE void put(const std::string& value, Stream* wrapper) { wrapper->writeBuf(value.c_str(), value.length()); }
|
static FORCEINLINE void put(const std::string& value, Stream* wrapper) { wrapper->writeBuf(value.c_str(), value.length()); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template<char... digits> struct to_str { static const char s[]; };
|
|
||||||
template<char... digits> constexpr char to_str<digits...>::s[] = { ('0' + digits)..., 0 };
|
|
||||||
|
|
||||||
template<uint64_t N, char... digits>
|
|
||||||
struct Str : Str<N / 10, N % 10, digits...> {};
|
|
||||||
|
|
||||||
template<char... digits>
|
|
||||||
struct Str<0, digits...> : to_str<digits...> {};
|
|
||||||
|
|
||||||
template<uint64_t N, char... digits>
|
|
||||||
struct log::Stream::Entry<Str<N, digits...>>
|
|
||||||
{
|
|
||||||
static FORCEINLINE void put(Str<N, digits...>&& value, Stream* wrapper)
|
|
||||||
{
|
|
||||||
wrapper->writeBuf(value.s, sizeof(value.s) - 1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Hashrate
|
struct Hashrate
|
||||||
{
|
{
|
||||||
explicit FORCEINLINE Hashrate(uint64_t data) : m_data(data) {}
|
explicit FORCEINLINE Hashrate(uint64_t data) : m_data(data) {}
|
||||||
|
|
|
@ -447,7 +447,7 @@ bool TCPServer<READ_BUF_SIZE, WRITE_BUF_SIZE>::send_internal(Client* client, Sen
|
||||||
const size_t bytes_written = callback(buf->m_data);
|
const size_t bytes_written = callback(buf->m_data);
|
||||||
|
|
||||||
if (bytes_written > sizeof(buf->m_data)) {
|
if (bytes_written > sizeof(buf->m_data)) {
|
||||||
LOGERR(0, "send callback wrote " << bytes_written << " bytes, expected no more than " << log::Str<sizeof(buf->m_data)>() << " bytes");
|
LOGERR(0, "send callback wrote " << bytes_written << " bytes, expected no more than " << sizeof(buf->m_data) << " bytes");
|
||||||
panic();
|
panic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue