From 28143dc99d3d4bbc0454308c6572176cfc306c97 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 11 Sep 2024 15:41:51 -0700 Subject: [PATCH] Cleanup chrono --- include/fmt/chrono.h | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index de06dfaf..26975cd7 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -293,12 +293,12 @@ inline auto gmtime_s(...) -> null<> { return null<>(); } // It is defined here and not in ostream.h because the latter has expensive // includes. -template class formatbuf : public Streambuf { +template class formatbuf : public StreamBuf { private: - using char_type = typename Streambuf::char_type; - using streamsize = decltype(std::declval().sputn(nullptr, 0)); - using int_type = typename Streambuf::int_type; - using traits_type = typename Streambuf::traits_type; + using char_type = typename StreamBuf::char_type; + using streamsize = decltype(std::declval().sputn(nullptr, 0)); + using int_type = typename StreamBuf::int_type; + using traits_type = typename StreamBuf::traits_type; buffer& buffer_; @@ -336,20 +336,16 @@ template struct codecvt_result { }; template -void write_codecvt(codecvt_result& out, string_view in_buf, +void write_codecvt(codecvt_result& out, string_view in, const std::locale& loc) { -#if FMT_CLANG_VERSION -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdeprecated" + FMT_CLANG_PRAGMA(diagnostic push) + FMT_CLANG_PRAGMA(diagnostic ignored "-Wdeprecated") auto& f = std::use_facet>(loc); -# pragma clang diagnostic pop -#else - auto& f = std::use_facet>(loc); -#endif + FMT_CLANG_PRAGMA(diagnostic pop) auto mb = std::mbstate_t(); const char* from_next = nullptr; - auto result = f.in(mb, in_buf.begin(), in_buf.end(), from_next, - std::begin(out.buf), std::end(out.buf), out.end); + auto result = f.in(mb, in.begin(), in.end(), from_next, std::begin(out.buf), + std::end(out.buf), out.end); if (result != std::codecvt_base::ok) FMT_THROW(format_error("failed to format time")); }