When using MSVC x86 to compile v12.0.0 or v12.1.0, conversions from __int64 to a 32bit unsigned int trigger warnings. (#4594)

This is a follow-up for PR #4572.
This commit is contained in:
J. Berger
2025-11-01 17:38:30 +01:00
committed by GitHub
parent 27bf8b47fe
commit c3be070b7e

View File

@@ -2534,7 +2534,7 @@ FMT_CONSTEXPR20 auto write_fixed(OutputIt out, const DecimalFP& f,
auto grouping = Grouping(loc, specs.localized()); auto grouping = Grouping(loc, specs.localized());
size += grouping.count_separators(exp); size += grouping.count_separators(exp);
return write_padded<Char, align::right>( return write_padded<Char, align::right>(
out, specs, to_unsigned(size), [&](iterator it) { out, specs, static_cast<size_t>(size), [&](iterator it) {
if (s != sign::none) *it++ = detail::getsign<Char>(s); if (s != sign::none) *it++ = detail::getsign<Char>(s);
it = write_significand(it, f.significand, significand_size, exp, it = write_significand(it, f.significand, significand_size, exp,
decimal_point, grouping); decimal_point, grouping);
@@ -2550,7 +2550,7 @@ FMT_CONSTEXPR20 auto write_fixed(OutputIt out, const DecimalFP& f,
bool pointy = num_zeros != 0 || significand_size != 0 || specs.alt(); bool pointy = num_zeros != 0 || significand_size != 0 || specs.alt();
size += 1 + (pointy ? 1 : 0) + num_zeros; size += 1 + (pointy ? 1 : 0) + num_zeros;
return write_padded<Char, align::right>( return write_padded<Char, align::right>(
out, specs, to_unsigned(size), [&](iterator it) { out, specs, static_cast<size_t>(size), [&](iterator it) {
if (s != sign::none) *it++ = detail::getsign<Char>(s); if (s != sign::none) *it++ = detail::getsign<Char>(s);
*it++ = Char('0'); *it++ = Char('0');
if (!pointy) return it; if (!pointy) return it;
@@ -2594,7 +2594,7 @@ FMT_CONSTEXPR20 auto do_write_float(OutputIt out, const DecimalFP& f,
*it++ = Char(exp_char); *it++ = Char(exp_char);
return write_exponent<Char>(exp, it); return write_exponent<Char>(exp, it);
}; };
auto usize = to_unsigned(size); size_t usize = static_cast<size_t>(size);
return specs.width > 0 return specs.width > 0
? write_padded<Char, align::right>(out, specs, usize, write) ? write_padded<Char, align::right>(out, specs, usize, write)
: base_iterator(out, write(reserve(out, usize))); : base_iterator(out, write(reserve(out, usize)));