fix warning in header: signed/unsigned comparison

This commit is contained in:
JP Cimalando 2017-11-12 08:39:10 +01:00 committed by Victor Zverovich
parent 11415bce3c
commit 1d751bc617

View File

@ -3940,7 +3940,8 @@ const Char *BasicFormatter<Char, ArgFormatter>::format(
default:
FMT_THROW(FormatError("width is not integer"));
}
if (value > (std::numeric_limits<int>::max)())
unsigned max_int = (std::numeric_limits<int>::max)();
if (value > max_int)
FMT_THROW(FormatError("number is too big"));
spec.width_ = static_cast<int>(value);
}
@ -3978,7 +3979,8 @@ const Char *BasicFormatter<Char, ArgFormatter>::format(
default:
FMT_THROW(FormatError("precision is not integer"));
}
if (value > (std::numeric_limits<int>::max)())
unsigned max_int = (std::numeric_limits<int>::max)();
if (value > max_int)
FMT_THROW(FormatError("number is too big"));
spec.precision_ = static_cast<int>(value);
} else {