mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 03:17:53 +00:00
Avoid conflict with the macro CHAR_WIDTH
It looks like CHAR_WIDTH is a macro in glibc. See https://sourceware.org/ml/libc-alpha/2016-09/msg00225.html
This commit is contained in:
parent
f03a35a679
commit
0e914372fb
@ -1983,21 +1983,21 @@ class arg_formatter_base {
|
||||
using pointer_type = typename basic_writer<Char>::pointer_type;
|
||||
Char fill = internal::char_traits<Char>::cast(specs_.fill());
|
||||
pointer_type out = pointer_type();
|
||||
const unsigned CHAR_WIDTH = 1;
|
||||
if (specs_.width_ > CHAR_WIDTH) {
|
||||
const unsigned character_width = 1;
|
||||
if (specs_.width_ > character_width) {
|
||||
out = writer_.grow_buffer(specs_.width_);
|
||||
if (specs_.align_ == ALIGN_RIGHT) {
|
||||
std::uninitialized_fill_n(out, specs_.width_ - CHAR_WIDTH, fill);
|
||||
out += specs_.width_ - CHAR_WIDTH;
|
||||
std::uninitialized_fill_n(out, specs_.width_ - character_width, fill);
|
||||
out += specs_.width_ - character_width;
|
||||
} else if (specs_.align_ == ALIGN_CENTER) {
|
||||
out = writer_.fill_padding(out, specs_.width_,
|
||||
internal::const_check(CHAR_WIDTH), fill);
|
||||
internal::const_check(character_width), fill);
|
||||
} else {
|
||||
std::uninitialized_fill_n(out + CHAR_WIDTH,
|
||||
specs_.width_ - CHAR_WIDTH, fill);
|
||||
std::uninitialized_fill_n(out + character_width,
|
||||
specs_.width_ - character_width, fill);
|
||||
}
|
||||
} else {
|
||||
out = writer_.grow_buffer(CHAR_WIDTH);
|
||||
out = writer_.grow_buffer(character_width);
|
||||
}
|
||||
*out = internal::char_traits<Char>::cast(value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user