mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-02 11:28:20 +00:00
Fix build under g++-4.9, SunOS 5.11 i386 i86pc Solaris
* thanks @VolodymyrLavrenchuk for pointing this out.
This commit is contained in:
parent
33ec5b16d8
commit
ef7d4879e4
@ -226,14 +226,14 @@ void format_error_code(fmt::Writer &out, int error_code,
|
||||
// bad_alloc.
|
||||
out.clear();
|
||||
static const char SEP[] = ": ";
|
||||
static const char ERR[] = "error ";
|
||||
static const char _ERR[] = "error ";
|
||||
fmt::internal::IntTraits<int>::MainType ec_value = error_code;
|
||||
// Subtract 2 to account for terminating null characters in SEP and ERR.
|
||||
// Subtract 2 to account for terminating null characters in SEP and _ERR.
|
||||
std::size_t error_code_size =
|
||||
sizeof(SEP) + sizeof(ERR) + fmt::internal::count_digits(ec_value) - 2;
|
||||
sizeof(SEP) + sizeof(_ERR) + fmt::internal::count_digits(ec_value) - 2;
|
||||
if (message.size() <= fmt::internal::INLINE_BUFFER_SIZE - error_code_size)
|
||||
out << message << SEP;
|
||||
out << ERR << error_code;
|
||||
out << _ERR << error_code;
|
||||
assert(out.size() <= fmt::internal::INLINE_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user