From b71dfce1f7eefcd6c0dc99f162899b053d7fe082 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 16 Jul 2024 06:39:45 +0800 Subject: [PATCH] Fix build with fmt11 Since fmt 11.0.0, formatter:format() is required to be const. Mark all of the specializations as const to be compatible with fmt 11. This change is implemented in the same spirit of 7725f6ed5a. Signed-off-by: Kefu Chai --- include/util/format.hpp | 2 +- src/modules/sni/item.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/util/format.hpp b/include/util/format.hpp index a5630cf4..cf8d706b 100644 --- a/include/util/format.hpp +++ b/include/util/format.hpp @@ -92,7 +92,7 @@ struct formatter { template <> struct formatter : formatter { template - auto format(const Glib::ustring& value, FormatContext& ctx) { + auto format(const Glib::ustring& value, FormatContext& ctx) const { return formatter::format(static_cast(value), ctx); } }; diff --git a/src/modules/sni/item.cpp b/src/modules/sni/item.cpp index b5c0dd85..6c4ec8c0 100644 --- a/src/modules/sni/item.cpp +++ b/src/modules/sni/item.cpp @@ -14,14 +14,14 @@ template <> struct fmt::formatter : formatter { - bool is_printable(const Glib::VariantBase& value) { + bool is_printable(const Glib::VariantBase& value) const { auto type = value.get_type_string(); /* Print only primitive (single character excluding 'v') and short complex types */ return (type.length() == 1 && islower(type[0]) && type[0] != 'v') || value.get_size() <= 32; } template - auto format(const Glib::VariantBase& value, FormatContext& ctx) { + auto format(const Glib::VariantBase& value, FormatContext& ctx) const { if (is_printable(value)) { return formatter::format(static_cast(value.print()), ctx); } else {