diff --git a/format.cc b/format.cc index cd9de152..f00833ec 100644 --- a/format.cc +++ b/format.cc @@ -136,10 +136,11 @@ typename fmt::BasicWriter::CharPtr unsigned total_size, std::size_t content_size, wchar_t fill) { std::size_t padding = total_size - content_size; std::size_t left_padding = padding / 2; - std::fill_n(buffer, left_padding, fill); + Char fill_char = static_cast(fill); + std::fill_n(buffer, left_padding, fill_char); buffer += left_padding; CharPtr content = buffer; - std::fill_n(buffer + content_size, padding - left_padding, fill); + std::fill_n(buffer + content_size, padding - left_padding, fill_char); return content; } @@ -179,12 +180,13 @@ typename fmt::BasicWriter::CharPtr CharPtr p = GrowBuffer(width); CharPtr end = p + width; Alignment align = spec.align(); + Char fill = static_cast(spec.fill()); if (align == ALIGN_LEFT) { *p = sign; p += size; - std::fill(p, end, spec.fill()); + std::fill(p, end, fill); } else if (align == ALIGN_CENTER) { - p = FillPadding(p, width, size, spec.fill()); + p = FillPadding(p, width, size, fill); *p = sign; p += size; } else { @@ -196,7 +198,7 @@ typename fmt::BasicWriter::CharPtr } else { *(end - size) = sign; } - std::fill(p, end - size, spec.fill()); + std::fill(p, end - size, fill); p = end; } return p - 1; diff --git a/format.h b/format.h index 22815e1b..28669c2c 100644 --- a/format.h +++ b/format.h @@ -558,13 +558,14 @@ typename BasicWriter::CharPtr BasicWriter::FormatString( CharPtr out = CharPtr(); if (spec.width() > size) { out = GrowBuffer(spec.width()); + Char fill = static_cast(spec.fill()); if (spec.align() == ALIGN_RIGHT) { - std::fill_n(out, spec.width() - size, spec.fill()); + std::fill_n(out, spec.width() - size, fill); out += spec.width() - size; } else if (spec.align() == ALIGN_CENTER) { - out = FillPadding(out, spec.width(), size, spec.fill()); + out = FillPadding(out, spec.width(), size, fill); } else { - std::fill_n(out + size, spec.width() - size, spec.fill()); + std::fill_n(out + size, spec.width() - size, fill); } } else { out = GrowBuffer(size);