mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-23 10:50:05 +00:00
Fix warnings
This commit is contained in:
parent
6a497e1d06
commit
6bcc3fd216
@ -271,7 +271,7 @@ To safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from,
|
||||
ec = 1;
|
||||
return {};
|
||||
}
|
||||
count *= Factor::num;
|
||||
count *= static_cast<IntermediateRep>(Factor::num);
|
||||
}
|
||||
|
||||
// this can't go wrong, right? den>0 is checked earlier.
|
||||
|
@ -167,7 +167,7 @@ struct scan_handler : error_handler {
|
||||
}
|
||||
|
||||
void on_arg_id() { on_arg_id(next_arg_id_++); }
|
||||
void on_arg_id(unsigned id) {
|
||||
void on_arg_id(int id) {
|
||||
if (id >= args_.size) on_error("argument index out of range");
|
||||
arg_ = args_.data[id];
|
||||
}
|
||||
|
@ -107,7 +107,8 @@ template <> struct std::formatter<S> {
|
||||
// Parses a width argument id in the format { <digit> }.
|
||||
constexpr auto parse(format_parse_context& ctx) {
|
||||
auto iter = ctx.begin();
|
||||
auto get_char = [&]() { return iter != ctx.end() ? *iter : 0; };
|
||||
// auto get_char = [&]() { return iter != ctx.end() ? *iter : 0; };
|
||||
auto get_char = [&]() { return iter != ctx.end() ? *iter : '\0'; };
|
||||
if (get_char() != '{') return iter;
|
||||
++iter;
|
||||
char c = get_char();
|
||||
@ -124,7 +125,9 @@ template <> struct std::formatter<S> {
|
||||
[](auto value) -> int {
|
||||
if constexpr (!is_integral_v<decltype(value)>)
|
||||
throw format_error("width is not integral");
|
||||
else if (value < 0 || value > numeric_limits<int>::max())
|
||||
// else if (value < 0 || value > numeric_limits<int>::max())
|
||||
else if (fmt::internal::is_negative(value) < 0 ||
|
||||
value > numeric_limits<int>::max())
|
||||
throw format_error("invalid width");
|
||||
else
|
||||
return value;
|
||||
|
Loading…
Reference in New Issue
Block a user