TagPrint, command/File: two more libfmt 10 workarounds
libfmt 10 doesn't know how to format a StringView, and doesn't cast to std::string_view anymore. The StringView class has been removed from MPD 0.24 completely, and this is a stable-branch-only workaround. Closes https://github.com/MusicPlayerDaemon/MPD/pull/1814
This commit is contained in:
parent
381934985a
commit
e1e37cfe3c
|
@ -35,8 +35,9 @@ tag_print_types(Response &r) noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
tag_print(Response &r, TagType type, StringView value) noexcept
|
tag_print(Response &r, TagType type, StringView _value) noexcept
|
||||||
{
|
{
|
||||||
|
const std::string_view value{_value};
|
||||||
r.Fmt(FMT_STRING("{}: {}\n"), tag_item_names[type], value);
|
r.Fmt(FMT_STRING("{}: {}\n"), tag_item_names[type], value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,8 @@ public:
|
||||||
explicit PrintCommentHandler(Response &_response) noexcept
|
explicit PrintCommentHandler(Response &_response) noexcept
|
||||||
:NullTagHandler(WANT_PAIR), response(_response) {}
|
:NullTagHandler(WANT_PAIR), response(_response) {}
|
||||||
|
|
||||||
void OnPair(StringView key, StringView value) noexcept override {
|
void OnPair(StringView _key, StringView _value) noexcept override {
|
||||||
|
const std::string_view key{_key}, value{_value};
|
||||||
if (IsValidName(key) && IsValidValue(value))
|
if (IsValidName(key) && IsValidValue(value))
|
||||||
response.Fmt(FMT_STRING("{}: {}\n"), key, value);
|
response.Fmt(FMT_STRING("{}: {}\n"), key, value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue