Skip to content

Commit

Permalink
Merge pull request #3441 from tchaikov/fmt-format-const
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexays authored Jul 16, 2024
2 parents 5f3a9d9 + b71dfce commit f6ff649
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/util/format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ struct formatter<pow_format> {
template <>
struct formatter<Glib::ustring> : formatter<std::string> {
template <typename FormatContext>
auto format(const Glib::ustring& value, FormatContext& ctx) {
auto format(const Glib::ustring& value, FormatContext& ctx) const {
return formatter<std::string>::format(static_cast<std::string>(value), ctx);
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/modules/sni/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@

template <>
struct fmt::formatter<Glib::VariantBase> : formatter<std::string> {
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 <typename FormatContext>
auto format(const Glib::VariantBase& value, FormatContext& ctx) {
auto format(const Glib::VariantBase& value, FormatContext& ctx) const {
if (is_printable(value)) {
return formatter<std::string>::format(static_cast<std::string>(value.print()), ctx);
} else {
Expand Down

0 comments on commit f6ff649

Please sign in to comment.