mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 10:47:35 +02:00
CHAR_WIDTH -> CHAR_SIZE to avoid collision with ISO/IEC TS 18661-1:2014 macro
(cherry picked from commit abbefd7166
)
This commit is contained in:
committed by
Jonathan Müller
parent
0a0c2c9cdd
commit
fb9015b3a1
16
fmt/format.h
16
fmt/format.h
@ -1869,21 +1869,21 @@ class ArgFormatterBase : public ArgVisitor<Impl, void> {
|
|||||||
typedef typename BasicWriter<Char>::CharPtr CharPtr;
|
typedef typename BasicWriter<Char>::CharPtr CharPtr;
|
||||||
Char fill = internal::CharTraits<Char>::cast(spec_.fill());
|
Char fill = internal::CharTraits<Char>::cast(spec_.fill());
|
||||||
CharPtr out = CharPtr();
|
CharPtr out = CharPtr();
|
||||||
const unsigned CHAR_WIDTH = 1;
|
const unsigned CHAR_SIZE = 1;
|
||||||
if (spec_.width_ > CHAR_WIDTH) {
|
if (spec_.width_ > CHAR_SIZE) {
|
||||||
out = writer_.grow_buffer(spec_.width_);
|
out = writer_.grow_buffer(spec_.width_);
|
||||||
if (spec_.align_ == ALIGN_RIGHT) {
|
if (spec_.align_ == ALIGN_RIGHT) {
|
||||||
std::uninitialized_fill_n(out, spec_.width_ - CHAR_WIDTH, fill);
|
std::uninitialized_fill_n(out, spec_.width_ - CHAR_SIZE, fill);
|
||||||
out += spec_.width_ - CHAR_WIDTH;
|
out += spec_.width_ - CHAR_SIZE;
|
||||||
} else if (spec_.align_ == ALIGN_CENTER) {
|
} else if (spec_.align_ == ALIGN_CENTER) {
|
||||||
out = writer_.fill_padding(out, spec_.width_,
|
out = writer_.fill_padding(out, spec_.width_,
|
||||||
internal::const_check(CHAR_WIDTH), fill);
|
internal::const_check(CHAR_SIZE), fill);
|
||||||
} else {
|
} else {
|
||||||
std::uninitialized_fill_n(out + CHAR_WIDTH,
|
std::uninitialized_fill_n(out + CHAR_SIZE,
|
||||||
spec_.width_ - CHAR_WIDTH, fill);
|
spec_.width_ - CHAR_SIZE, fill);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
out = writer_.grow_buffer(CHAR_WIDTH);
|
out = writer_.grow_buffer(CHAR_SIZE);
|
||||||
}
|
}
|
||||||
*out = internal::CharTraits<Char>::cast(value);
|
*out = internal::CharTraits<Char>::cast(value);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user