Fix warning C4365 emitted from printf.h (#3865)

This commit is contained in:
Baardi
2024-02-24 00:33:21 +00:00
committed by GitHub
parent 0166f455f6
commit ddf0b7d2b5

View File

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