arg.enforce(arg.widthIndex == FormatArg::kNoIndex,
"cannot provide width arg index without value arg index");
int sizeArg = nextArg++;
arg.enforce(arg.widthIndex == FormatArg::kNoIndex,
"cannot provide width arg index without value arg index");
int sizeArg = nextArg++;
if (arg.width == FormatArg::kDynamicWidth) {
arg.enforce(arg.widthIndex != FormatArg::kNoIndex,
"cannot provide value arg index without width arg index");
if (arg.width == FormatArg::kDynamicWidth) {
arg.enforce(arg.widthIndex != FormatArg::kNoIndex,
"cannot provide value arg index without width arg index");
if (arg.precision != FormatArg::kDefaultPrecision &&
val.size() > static_cast<size_t>(arg.precision)) {
if (arg.precision != FormatArg::kDefaultPrecision &&
val.size() > static_cast<size_t>(arg.precision)) {
auto pad = [&padBuf, &cb, padBufSize] (int chars) {
while (chars) {
int n = std::min(chars, padBufSize);
auto pad = [&padBuf, &cb, padBufSize] (int chars) {
while (chars) {
int n = std::min(chars, padBufSize);
val.size() < static_cast<size_t>(arg.width)) {
char fill = arg.fill == FormatArg::kDefaultFill ? ' ' : arg.fill;
int padChars = static_cast<int> (arg.width - val.size());
val.size() < static_cast<size_t>(arg.width)) {
char fill = arg.fill == FormatArg::kDefaultFill ? ' ' : arg.fill;
int padChars = static_cast<int> (arg.width - val.size());
- memset(padBuf, fill, std::min(padBufSize, padChars));
+ memset(padBuf, fill, size_t(std::min(padBufSize, padChars)));
arg.align = FormatArg::Align::RIGHT;
} else if (prefixLen && arg.align == FormatArg::Align::PAD_AFTER_SIGN) {
// Split off the prefix, then do any padding if necessary
arg.align = FormatArg::Align::RIGHT;
} else if (prefixLen && arg.align == FormatArg::Align::PAD_AFTER_SIGN) {
// Split off the prefix, then do any padding if necessary
- cb(val.subpiece(0, prefixLen));
- val.advance(prefixLen);
+ cb(val.subpiece(0, size_t(prefixLen)));
+ val.advance(size_t(prefixLen));
arg.width = std::max(arg.width - prefixLen, 0);
}
format_value::formatString(val, arg, cb);
arg.width = std::max(arg.width - prefixLen, 0);
}
format_value::formatString(val, arg, cb);
int len = snprintf(valBufBegin, (valBuf + valBufSize) - valBufBegin,
"%" PRIuMAX, static_cast<uintmax_t>(uval));
#else
int len = snprintf(valBufBegin, (valBuf + valBufSize) - valBufBegin,
"%" PRIuMAX, static_cast<uintmax_t>(uval));
#else
- int len = snprintf(valBufBegin, (valBuf + valBufSize) - valBufBegin,
- "%ju", static_cast<uintmax_t>(uval));
+ int len = snprintf(
+ valBufBegin,
+ size_t((valBuf + valBufSize) - valBufBegin),
+ "%ju",
+ static_cast<uintmax_t>(uval));
"invalid specifier '", arg.presentation, "'");
format_value::formatString(val_, arg, cb);
} else {
"invalid specifier '", arg.presentation, "'");
format_value::formatString(val_, arg, cb);
} else {