mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 02:37:36 +02:00
Fix warnings
This commit is contained in:
@ -271,7 +271,7 @@ To safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from,
|
|||||||
ec = 1;
|
ec = 1;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
count *= Factor::num;
|
count *= static_cast<IntermediateRep>(Factor::num);
|
||||||
}
|
}
|
||||||
|
|
||||||
// this can't go wrong, right? den>0 is checked earlier.
|
// 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() { 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");
|
if (id >= args_.size) on_error("argument index out of range");
|
||||||
arg_ = args_.data[id];
|
arg_ = args_.data[id];
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,8 @@ template <> struct std::formatter<S> {
|
|||||||
// Parses a width argument id in the format { <digit> }.
|
// Parses a width argument id in the format { <digit> }.
|
||||||
constexpr auto parse(format_parse_context& ctx) {
|
constexpr auto parse(format_parse_context& ctx) {
|
||||||
auto iter = ctx.begin();
|
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;
|
if (get_char() != '{') return iter;
|
||||||
++iter;
|
++iter;
|
||||||
char c = get_char();
|
char c = get_char();
|
||||||
@ -124,7 +125,9 @@ template <> struct std::formatter<S> {
|
|||||||
[](auto value) -> int {
|
[](auto value) -> int {
|
||||||
if constexpr (!is_integral_v<decltype(value)>)
|
if constexpr (!is_integral_v<decltype(value)>)
|
||||||
throw format_error("width is not integral");
|
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");
|
throw format_error("invalid width");
|
||||||
else
|
else
|
||||||
return value;
|
return value;
|
||||||
|
Reference in New Issue
Block a user