mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-02 11:28:20 +00:00
fix warning in header: signed/unsigned comparison
This commit is contained in:
parent
11415bce3c
commit
1d751bc617
@ -3940,7 +3940,8 @@ const Char *BasicFormatter<Char, ArgFormatter>::format(
|
|||||||
default:
|
default:
|
||||||
FMT_THROW(FormatError("width is not integer"));
|
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"));
|
FMT_THROW(FormatError("number is too big"));
|
||||||
spec.width_ = static_cast<int>(value);
|
spec.width_ = static_cast<int>(value);
|
||||||
}
|
}
|
||||||
@ -3978,7 +3979,8 @@ const Char *BasicFormatter<Char, ArgFormatter>::format(
|
|||||||
default:
|
default:
|
||||||
FMT_THROW(FormatError("precision is not integer"));
|
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"));
|
FMT_THROW(FormatError("number is too big"));
|
||||||
spec.precision_ = static_cast<int>(value);
|
spec.precision_ = static_cast<int>(value);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user