From 4ad51c1a8e92399f4aaed66b9e54217789f38b576076d8a3968b88775917c24d Mon Sep 17 00:00:00 2001 From: Bernd Ritter Date: Wed, 17 May 2023 18:58:05 +0000 Subject: [PATCH] added fix for issue 2735 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/spdlog?expand=0&rev=79 --- spdlog.spec | 2 ++ tt4g-fix-2735.diff | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 tt4g-fix-2735.diff diff --git a/spdlog.spec b/spdlog.spec index d1de70f..90264b1 100644 --- a/spdlog.spec +++ b/spdlog.spec @@ -29,6 +29,8 @@ Source0: https://github.com/gabime/%{name}/archive/v%{version}.tar.gz#/%{ Patch0: 0ca574ae168820da0268b3ec7607ca7b33024d05.patch # PATCH-FIX-UPSTREAM v1.11.0_removed_brackets_for_fmt_10.diff Patch1: v1.11.0_removed_brackets_for_fmt_10.diff +# PATCH-FIX-UPSTREAM tt4g-fix-2735.diff +Patch2: tt4g-fix-2735.diff Source99: baselibs.conf BuildRequires: cmake >= 3.10 %if 0%{?suse_version} > 1500 diff --git a/tt4g-fix-2735.diff b/tt4g-fix-2735.diff new file mode 100644 index 0000000..71141af --- /dev/null +++ b/tt4g-fix-2735.diff @@ -0,0 +1,50 @@ +diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h +index f6f1bb1d..31516ee2 100644 +--- a/include/spdlog/sinks/daily_file_sink.h ++++ b/include/spdlog/sinks/daily_file_sink.h +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + + namespace spdlog { + namespace sinks { +@@ -48,7 +49,6 @@ struct daily_filename_format_calculator + { + static filename_t calc_filename(const filename_t &filename, const tm &now_tm) + { +-#ifdef SPDLOG_USE_STD_FORMAT + // adapted from fmtlib: https://github.com/fmtlib/fmt/blob/8.0.1/include/fmt/chrono.h#L522-L546 + + filename_t tm_format; +@@ -59,7 +59,7 @@ struct daily_filename_format_calculator + tm_format.push_back(' '); + + const size_t MIN_SIZE = 10; +- filename_t buf; ++ std::vector buf; + buf.resize(MIN_SIZE); + for (;;) + { +@@ -73,19 +73,7 @@ struct daily_filename_format_calculator + buf.resize(buf.size() * 2); + } + +- return buf; +-#else +- // generate fmt datetime format string, e.g. {:%Y-%m-%d}. +- filename_t fmt_filename = fmt::format(SPDLOG_FMT_STRING(SPDLOG_FILENAME_T("{{:{}}}")), filename); +- +- // MSVC doesn't allow fmt::runtime(..) with wchar, with fmtlib versions < 9.1.x +-# if defined(_MSC_VER) && defined(SPDLOG_WCHAR_FILENAMES) && FMT_VERSION < 90101 +- return fmt::format(fmt_filename, now_tm); +-# else +- return fmt::format(SPDLOG_FMT_RUNTIME(fmt_filename), now_tm); +-# endif +- +-#endif ++ return std::string(buf.cbegin(), buf.cend()); + } + + private: