Fix more warnings.
This commit is contained in:
parent
88972f487b
commit
563a575c0c
12
format.cc
12
format.cc
@ -136,10 +136,11 @@ typename fmt::BasicWriter<Char>::CharPtr
|
|||||||
unsigned total_size, std::size_t content_size, wchar_t fill) {
|
unsigned total_size, std::size_t content_size, wchar_t fill) {
|
||||||
std::size_t padding = total_size - content_size;
|
std::size_t padding = total_size - content_size;
|
||||||
std::size_t left_padding = padding / 2;
|
std::size_t left_padding = padding / 2;
|
||||||
std::fill_n(buffer, left_padding, fill);
|
Char fill_char = static_cast<Char>(fill);
|
||||||
|
std::fill_n(buffer, left_padding, fill_char);
|
||||||
buffer += left_padding;
|
buffer += left_padding;
|
||||||
CharPtr content = buffer;
|
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;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,12 +180,13 @@ typename fmt::BasicWriter<Char>::CharPtr
|
|||||||
CharPtr p = GrowBuffer(width);
|
CharPtr p = GrowBuffer(width);
|
||||||
CharPtr end = p + width;
|
CharPtr end = p + width;
|
||||||
Alignment align = spec.align();
|
Alignment align = spec.align();
|
||||||
|
Char fill = static_cast<Char>(spec.fill());
|
||||||
if (align == ALIGN_LEFT) {
|
if (align == ALIGN_LEFT) {
|
||||||
*p = sign;
|
*p = sign;
|
||||||
p += size;
|
p += size;
|
||||||
std::fill(p, end, spec.fill());
|
std::fill(p, end, fill);
|
||||||
} else if (align == ALIGN_CENTER) {
|
} else if (align == ALIGN_CENTER) {
|
||||||
p = FillPadding(p, width, size, spec.fill());
|
p = FillPadding(p, width, size, fill);
|
||||||
*p = sign;
|
*p = sign;
|
||||||
p += size;
|
p += size;
|
||||||
} else {
|
} else {
|
||||||
@ -196,7 +198,7 @@ typename fmt::BasicWriter<Char>::CharPtr
|
|||||||
} else {
|
} else {
|
||||||
*(end - size) = sign;
|
*(end - size) = sign;
|
||||||
}
|
}
|
||||||
std::fill(p, end - size, spec.fill());
|
std::fill(p, end - size, fill);
|
||||||
p = end;
|
p = end;
|
||||||
}
|
}
|
||||||
return p - 1;
|
return p - 1;
|
||||||
|
7
format.h
7
format.h
@ -558,13 +558,14 @@ typename BasicWriter<Char>::CharPtr BasicWriter<Char>::FormatString(
|
|||||||
CharPtr out = CharPtr();
|
CharPtr out = CharPtr();
|
||||||
if (spec.width() > size) {
|
if (spec.width() > size) {
|
||||||
out = GrowBuffer(spec.width());
|
out = GrowBuffer(spec.width());
|
||||||
|
Char fill = static_cast<Char>(spec.fill());
|
||||||
if (spec.align() == ALIGN_RIGHT) {
|
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;
|
out += spec.width() - size;
|
||||||
} else if (spec.align() == ALIGN_CENTER) {
|
} else if (spec.align() == ALIGN_CENTER) {
|
||||||
out = FillPadding(out, spec.width(), size, spec.fill());
|
out = FillPadding(out, spec.width(), size, fill);
|
||||||
} else {
|
} else {
|
||||||
std::fill_n(out + size, spec.width() - size, spec.fill());
|
std::fill_n(out + size, spec.width() - size, fill);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
out = GrowBuffer(size);
|
out = GrowBuffer(size);
|
||||||
|
Loading…
Reference in New Issue
Block a user