Fix warning C4365 emitted from printf.h

This commit is contained in:
Bård Sigurd Møller 2024-02-24 00:05:30 +01:00
parent 0166f455f6
commit 28115ebeca
No known key found for this signature in database
GPG Key ID: 2F7FA547B16AB2A2

View File

@ -60,7 +60,7 @@ namespace detail {
// signed and unsigned integers.
template <bool IsSigned> struct int_checker {
template <typename T> static auto fits_in_int(T value) -> bool {
unsigned max = max_value<int>();
unsigned max = to_unsigned(max_value<int>());
return value <= max;
}
static auto fits_in_int(bool) -> bool { return true; }
@ -205,7 +205,7 @@ class printf_width_handler {
specs_.align = align::left;
width = 0 - width;
}
unsigned int_max = max_value<int>();
unsigned int_max = to_unsigned(max_value<int>());
if (width > int_max) report_error("number is too big");
return static_cast<unsigned>(width);
}