From a42da90042e5b9d956dbdd4145176524057c8e4b Mon Sep 17 00:00:00 2001 From: Rudi Heitbaum Date: Fri, 5 Jul 2024 14:27:45 +0000 Subject: [PATCH] lib/fmt: support build with libfmt-11.0.0 Upstream libfmt commit fmtlib/fmt@d707292 now requires the format function to be const. Adjust the function prototype so it is const and can compile. Signed-off-by: Rudi Heitbaum Closes https://github.com/MusicPlayerDaemon/MPD/issues/2141 --- NEWS | 1 + src/lib/ffmpeg/LibFmt.hxx | 2 +- src/lib/fmt/AudioFormatFormatter.hxx | 4 ++-- src/lib/fmt/ExceptionFormatter.hxx | 2 +- src/lib/fmt/PathFormatter.hxx | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 4ebaca70f..2137da84f 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,5 @@ ver 0.23.16 (not yet released) +* support libfmt 11 ver 0.23.15 (2023/12/20) * decoder diff --git a/src/lib/ffmpeg/LibFmt.hxx b/src/lib/ffmpeg/LibFmt.hxx index 93bf57e6a..404515893 100644 --- a/src/lib/ffmpeg/LibFmt.hxx +++ b/src/lib/ffmpeg/LibFmt.hxx @@ -29,7 +29,7 @@ template<> struct fmt::formatter : formatter { template - auto format(const AVSampleFormat format, FormatContext &ctx) { + auto format(const AVSampleFormat format, FormatContext &ctx) const { const char *name = av_get_sample_fmt_name(format); if (name == nullptr) name = "?"; diff --git a/src/lib/fmt/AudioFormatFormatter.hxx b/src/lib/fmt/AudioFormatFormatter.hxx index 6838644c4..e06e7c3d8 100644 --- a/src/lib/fmt/AudioFormatFormatter.hxx +++ b/src/lib/fmt/AudioFormatFormatter.hxx @@ -39,7 +39,7 @@ template<> struct fmt::formatter : formatter { template - auto format(const SampleFormat format, FormatContext &ctx) { + auto format(const SampleFormat format, FormatContext &ctx) const { return formatter::format(sample_format_to_string(format), ctx); } @@ -49,7 +49,7 @@ template<> struct fmt::formatter : formatter { template - auto format(const AudioFormat &af, FormatContext &ctx) { + auto format(const AudioFormat &af, FormatContext &ctx) const { return formatter::format(ToString(af).c_str(), ctx); } diff --git a/src/lib/fmt/ExceptionFormatter.hxx b/src/lib/fmt/ExceptionFormatter.hxx index 31c9f0df2..d193689fa 100644 --- a/src/lib/fmt/ExceptionFormatter.hxx +++ b/src/lib/fmt/ExceptionFormatter.hxx @@ -38,7 +38,7 @@ template<> struct fmt::formatter : formatter { template - auto format(std::exception_ptr e, FormatContext &ctx) { + auto format(std::exception_ptr e, FormatContext &ctx) const { return formatter::format(GetFullMessage(e), ctx); } }; diff --git a/src/lib/fmt/PathFormatter.hxx b/src/lib/fmt/PathFormatter.hxx index 91aca6c7c..0f4477850 100644 --- a/src/lib/fmt/PathFormatter.hxx +++ b/src/lib/fmt/PathFormatter.hxx @@ -29,7 +29,7 @@ template<> struct fmt::formatter : formatter { template - auto format(Path path, FormatContext &ctx) { + auto format(Path path, FormatContext &ctx) const { return formatter::format(path.ToUTF8(), ctx); } };