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 <rudi@heitbaum.com>

Closes https://github.com/MusicPlayerDaemon/MPD/issues/2141
This commit is contained in:
Rudi Heitbaum
2024-07-05 14:27:45 +00:00
committed by Max Kellermann
parent d7d32ed6fc
commit a42da90042
5 changed files with 6 additions and 5 deletions

1
NEWS
View File

@@ -1,4 +1,5 @@
ver 0.23.16 (not yet released)
* support libfmt 11
ver 0.23.15 (2023/12/20)
* decoder

View File

@@ -29,7 +29,7 @@ template<>
struct fmt::formatter<AVSampleFormat> : formatter<string_view>
{
template<typename FormatContext>
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 = "?";

View File

@@ -39,7 +39,7 @@ template<>
struct fmt::formatter<SampleFormat> : formatter<string_view>
{
template<typename FormatContext>
auto format(const SampleFormat format, FormatContext &ctx) {
auto format(const SampleFormat format, FormatContext &ctx) const {
return formatter<string_view>::format(sample_format_to_string(format),
ctx);
}
@@ -49,7 +49,7 @@ template<>
struct fmt::formatter<AudioFormat> : formatter<string_view>
{
template<typename FormatContext>
auto format(const AudioFormat &af, FormatContext &ctx) {
auto format(const AudioFormat &af, FormatContext &ctx) const {
return formatter<string_view>::format(ToString(af).c_str(),
ctx);
}

View File

@@ -38,7 +38,7 @@ template<>
struct fmt::formatter<std::exception_ptr> : formatter<string_view>
{
template<typename FormatContext>
auto format(std::exception_ptr e, FormatContext &ctx) {
auto format(std::exception_ptr e, FormatContext &ctx) const {
return formatter<string_view>::format(GetFullMessage(e), ctx);
}
};

View File

@@ -29,7 +29,7 @@ template<>
struct fmt::formatter<Path> : formatter<string_view>
{
template<typename FormatContext>
auto format(Path path, FormatContext &ctx) {
auto format(Path path, FormatContext &ctx) const {
return formatter<string_view>::format(path.ToUTF8(), ctx);
}
};