Commit bd3fd3bf authored by Victor Zverovich's avatar Victor Zverovich

clang-format

parent 260c1159
......@@ -444,10 +444,8 @@ template <typename T> struct make_unsigned_or_unchanged<T, true> {
template <typename To, typename FromRep, typename FromPeriod>
To fmt_safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from) {
int ec;
To to= safe_duration_cast::safe_duration_cast<To>(from,ec);
if (ec) {
FMT_THROW(format_error("cannot format duration"));
}
To to = safe_duration_cast::safe_duration_cast<To>(from, ec);
if (ec) FMT_THROW(format_error("cannot format duration"));
return to;
}
#endif
......@@ -624,9 +622,7 @@ struct chrono_formatter {
void on_tz_name() {}
void on_24_hour(numeric_system ns) {
if (handle_nan_inf()) {
return;
}
if (handle_nan_inf()) return;
if (ns == numeric_system::standard) return write(hour(), 2);
auto time = tm();
......@@ -635,9 +631,7 @@ struct chrono_formatter {
}
void on_12_hour(numeric_system ns) {
if (handle_nan_inf()) {
return;
}
if (handle_nan_inf()) return;
if (ns == numeric_system::standard) return write(hour12(), 2);
auto time = tm();
......@@ -646,9 +640,7 @@ struct chrono_formatter {
}
void on_minute(numeric_system ns) {
if (handle_nan_inf()) {
return;
}
if (handle_nan_inf()) return;
if (ns == numeric_system::standard) return write(minute(), 2);
auto time = tm();
......@@ -657,9 +649,7 @@ struct chrono_formatter {
}
void on_second(numeric_system ns) {
if (handle_nan_inf()) {
return;
}
if (handle_nan_inf()) return;
if (ns == numeric_system::standard) {
write(second(), 2);
......@@ -684,9 +674,7 @@ struct chrono_formatter {
}
void on_12_hour_time() {
if (handle_nan_inf()) {
return;
}
if (handle_nan_inf()) return;
format_localized(time(), "%r");
}
......@@ -706,24 +694,17 @@ struct chrono_formatter {
void on_iso_time() {
on_24_hour_time();
*out++ = ':';
if (handle_nan_inf()) {
return;
}
if (handle_nan_inf()) return;
write(second(), 2);
}
void on_am_pm() {
if (handle_nan_inf()) {
return;
}
if (handle_nan_inf()) return;
format_localized(time(), "%p");
}
void on_duration_value() {
if (handle_nan_inf()) {
return;
}
if (handle_nan_inf()) return;
write_sign();
out = format_chrono_duration_value(out, val, precision);
}
......
......@@ -246,7 +246,8 @@ int format_float(char* buf, std::size_t size, const char* format, int precision,
T value) {
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
if (precision > 100000) {
throw std::runtime_error("fuzz mode - avoid large allocation inside snprintf");
throw std::runtime_error(
"fuzz mode - avoid large allocation inside snprintf");
}
#endif
// Suppress the warning about nonliteral format string.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment