Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master grimoire by Pavel Vinogradov (5c18819d2f7ada4a417b442eb7bfe701ea196648)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Pavel Vinogradov <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master grimoire by Pavel Vinogradov (5c18819d2f7ada4a417b442eb7bfe701ea196648)
  • Date: Tue, 16 May 2023 01:26:30 +0000

GIT changes to master grimoire by Pavel Vinogradov <public AT sourcemage.org>:

audio-players/mpd/HISTORY | 3
audio-players/mpd/patches/fmt-10.patch | 414
+++++++++++++++++++++++++++++++++
2 files changed, 417 insertions(+)

New commits:
commit 5c18819d2f7ada4a417b442eb7bfe701ea196648
Author: Pavel Vinogradov <public AT sourcemage.org>
Commit: Pavel Vinogradov <public AT sourcemage.org>

audio-players/mpd: fixed building with fmt 10

diff --git a/audio-players/mpd/HISTORY b/audio-players/mpd/HISTORY
index d931268..de341dc 100644
--- a/audio-players/mpd/HISTORY
+++ b/audio-players/mpd/HISTORY
@@ -1,3 +1,6 @@
+2023-05-15 Pavel Vinogradov <public AT sourcemage.org>
+ * patches/fmt-10.patch: added combined patch to fix building with fmt
10
+
2023-01-18 Pavel Vinpgradov <public AT sourcemage.org>
* DETAILS: version 0.23.12
* patches/mpd-0.23.11-boost-1.81.patch: dropped, no longer needed
diff --git a/audio-players/mpd/patches/fmt-10.patch
b/audio-players/mpd/patches/fmt-10.patch
new file mode 100644
index 0000000..54ae9f5
--- /dev/null
+++ b/audio-players/mpd/patches/fmt-10.patch
@@ -0,0 +1,414 @@
+From 181b96dd2d71bc8f2668776719d344466f258b5d Mon Sep 17 00:00:00 2001
+From: Max Kellermann <max.kellermann AT gmail.com>
+Date: Mon, 15 May 2023 20:52:21 +0200
+Subject: [PATCH] command/player, SongPrint: use AudioFormatFormatter()
+
+libfmt version 10 apparently doesn't know how to format a
+`StringBuffer`, failing the MPD build. Since we have a formatter
+specialization for `AudioFormat`, let's use that - it's better and
+easier to use.
+
+Closes https://github.com/MusicPlayerDaemon/MPD/issues/1807
+---
+ src/SongPrint.cxx | 5 +++--
+ src/command/PlayerCommands.cxx | 3 ++-
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/SongPrint.cxx b/src/SongPrint.cxx
+index 98d544cc38..835669d276 100644
+--- a/src/SongPrint.cxx
++++ b/src/SongPrint.cxx
+@@ -8,6 +8,7 @@
+ #include "TagPrint.hxx"
+ #include "client/Response.hxx"
+ #include "fs/Traits.hxx"
++#include "lib/fmt/AudioFormatFormatter.hxx"
+ #include "time/ChronoUtil.hxx"
+ #include "util/StringBuffer.hxx"
+ #include "util/UriUtil.hxx"
+@@ -77,7 +78,7 @@ song_print_info(Response &r, const LightSong &song, bool
base) noexcept
+ time_print(r, "Last-Modified", song.mtime);
+
+ if (song.audio_format.IsDefined())
+- r.Fmt(FMT_STRING("Format: {}\n"),
ToString(song.audio_format));
++ r.Fmt(FMT_STRING("Format: {}\n"), song.audio_format);
+
+ tag_print_values(r, song.tag);
+
+@@ -100,7 +101,7 @@ song_print_info(Response &r, const DetachedSong &song,
bool base) noexcept
+ time_print(r, "Last-Modified", song.GetLastModified());
+
+ if (const auto &f = song.GetAudioFormat(); f.IsDefined())
+- r.Fmt(FMT_STRING("Format: {}\n"), ToString(f));
++ r.Fmt(FMT_STRING("Format: {}\n"), f);
+
+ tag_print_values(r, song.GetTag());
+
+diff --git a/src/command/PlayerCommands.cxx b/src/command/PlayerCommands.cxx
+index 5108b9d3c4..0b5a917020 100644
+--- a/src/command/PlayerCommands.cxx
++++ b/src/command/PlayerCommands.cxx
+@@ -13,6 +13,7 @@
+ #include "Partition.hxx"
+ #include "Instance.hxx"
+ #include "IdleFlags.hxx"
++#include "lib/fmt/AudioFormatFormatter.hxx"
+ #include "util/StringBuffer.hxx"
+ #include "util/ScopeExit.hxx"
+ #include "util/Exception.hxx"
+@@ -170,7 +171,7 @@ handle_status(Client &client, [[maybe_unused]] Request
args, Response &r)
+
+ if (player_status.audio_format.IsDefined())
+ r.Fmt(FMT_STRING(COMMAND_STATUS_AUDIO ": {}\n"),
+- ToString(player_status.audio_format));
++ player_status.audio_format);
+ }
+
+ #ifdef ENABLE_DATABASE
+From f869593ac8913e52c711e974257bd6dc0d5dbf26 Mon Sep 17 00:00:00 2001
+From: Max Kellermann <max.kellermann AT gmail.com>
+Date: Mon, 15 May 2023 20:59:58 +0200
+Subject: [PATCH] TimePrint: minor fixup for libfmt 10
+
+libfmt version 10 has difficulties formatting a `StringBuffer`, and we
+need to help it by explicitly invoking the `c_str()` method.
+---
+ src/TimePrint.cxx | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/TimePrint.cxx b/src/TimePrint.cxx
+index 5bf05f6238..d47f3178bb 100644
+--- a/src/TimePrint.cxx
++++ b/src/TimePrint.cxx
+@@ -20,5 +20,5 @@ time_print(Response &r, const char *name,
+ return;
+ }
+
+- r.Fmt(FMT_STRING("{}: {}\n"), name, s);
++ r.Fmt(FMT_STRING("{}: {}\n"), name, s.c_str());
+ }
+From 96f99aeb8f9e213cbc54b6118902eae636d7f6e9 Mon Sep 17 00:00:00 2001
+From: Max Kellermann <max.kellermann AT gmail.com>
+Date: Fri, 1 Jul 2022 11:29:32 +0200
+Subject: [PATCH] TagPrint: use std::string_view
+
+---
+ src/TagPrint.cxx | 3 +--
+ src/TagPrint.hxx | 4 ++--
+ src/db/plugins/simple/Song.hxx | 1 -
+ 3 files changed, 3 insertions(+), 5 deletions(-)
+
+diff --git a/src/TagPrint.cxx b/src/TagPrint.cxx
+index e4d80e9bfb..33f82c3f2e 100644
+--- a/src/TagPrint.cxx
++++ b/src/TagPrint.cxx
+@@ -21,7 +21,6 @@
+ #include "tag/Tag.hxx"
+ #include "tag/Settings.hxx"
+ #include "client/Response.hxx"
+-#include "util/StringView.hxx"
+
+ #include <fmt/format.h>
+
+@@ -35,7 +34,7 @@ tag_print_types(Response &r) noexcept
+ }
+
+ void
+-tag_print(Response &r, TagType type, StringView value) noexcept
++tag_print(Response &r, TagType type, std::string_view value) noexcept
+ {
+ r.Fmt(FMT_STRING("{}: {}\n"), tag_item_names[type], value);
+ }
+diff --git a/src/TagPrint.hxx b/src/TagPrint.hxx
+index 268c536e65..b29fdf6b2f 100644
+--- a/src/TagPrint.hxx
++++ b/src/TagPrint.hxx
+@@ -21,18 +21,18 @@
+ #define MPD_TAG_PRINT_HXX
+
+ #include <cstdint>
++#include <string_view>
+
+ enum TagType : uint8_t;
+
+ struct Tag;
+-struct StringView;
+ class Response;
+
+ void
+ tag_print_types(Response &response) noexcept;
+
+ void
+-tag_print(Response &response, TagType type, StringView value) noexcept;
++tag_print(Response &response, TagType type, std::string_view value)
noexcept;
+
+ void
+ tag_print(Response &response, TagType type, const char *value) noexcept;
+diff --git a/src/db/plugins/simple/Song.hxx b/src/db/plugins/simple/Song.hxx
+index 8866c99470..45b3394225 100644
+--- a/src/db/plugins/simple/Song.hxx
++++ b/src/db/plugins/simple/Song.hxx
+@@ -30,7 +30,6 @@
+
+ #include <string>
+
+-struct StringView;
+ struct Directory;
+ class ExportedSong;
+ class DetachedSong;
+From ec66ee3bfb6ba3ec08ba4ee801462c6fee5e5fb6 Mon Sep 17 00:00:00 2001
+From: Max Kellermann <max.kellermann AT gmail.com>
+Date: Wed, 29 Jun 2022 16:44:23 +0200
+Subject: [PATCH] tag/Handler: use std::string_view instead of StringView
+
+---
+ src/command/FileCommands.cxx | 6 +++---
+ src/command/OtherCommands.cxx | 2 +-
+ src/decoder/plugins/AdPlugDecoderPlugin.cxx | 4 ++--
+ .../plugins/EmbeddedCuePlaylistPlugin.cxx | 11 +++++++----
+ src/tag/Handler.cxx | 18 ++++++++++--------
+ src/tag/Handler.hxx | 17 ++++++++++-------
+ test/read_tags.cxx | 10 +++++-----
+ 7 files changed, 38 insertions(+), 30 deletions(-)
+
+diff --git a/src/command/FileCommands.cxx b/src/command/FileCommands.cxx
+index 0c9ec4503a..31eec79fae 100644
+--- a/src/command/FileCommands.cxx
++++ b/src/command/FileCommands.cxx
+@@ -106,7 +106,7 @@ handle_listfiles_local(Response &r, Path path_fs)
+
+ gcc_pure
+ static bool
+-IsValidName(const StringView s) noexcept
++IsValidName(const std::string_view s) noexcept
+ {
+ if (s.empty() || !IsAlphaASCII(s.front()))
+ return false;
+@@ -118,7 +118,7 @@ IsValidName(const StringView s) noexcept
+
+ gcc_pure
+ static bool
+-IsValidValue(const StringView s) noexcept
++IsValidValue(const std::string_view s) noexcept
+ {
+ return std::none_of(s.begin(), s.end(), [](const auto &ch) { return
(unsigned char)ch < 0x20; });
+ }
+@@ -130,7 +130,7 @@ class PrintCommentHandler final : public NullTagHandler {
+ explicit PrintCommentHandler(Response &_response) noexcept
+ :NullTagHandler(WANT_PAIR), response(_response) {}
+
+- void OnPair(StringView key, StringView value) noexcept override {
++ void OnPair(std::string_view key, std::string_view value) noexcept
override {
+ if (IsValidName(key) && IsValidValue(value))
+ response.Fmt(FMT_STRING("{}: {}\n"), key, value);
+ }
+diff --git a/src/command/OtherCommands.cxx b/src/command/OtherCommands.cxx
+index 9cac216f09..aa99ad6203 100644
+--- a/src/command/OtherCommands.cxx
++++ b/src/command/OtherCommands.cxx
+@@ -148,7 +148,7 @@ class PrintTagHandler final : public NullTagHandler {
+ explicit PrintTagHandler(Response &_response) noexcept
+ :NullTagHandler(WANT_TAG), response(_response) {}
+
+- void OnTag(TagType type, StringView value) noexcept override {
++ void OnTag(TagType type, std::string_view value) noexcept override {
+ if (response.GetClient().tag_mask.Test(type))
+ tag_print(response, type, value);
+ }
+diff --git a/src/decoder/plugins/AdPlugDecoderPlugin.cxx
b/src/decoder/plugins/AdPlugDecoderPlugin.cxx
+index a494847d0d..3444ed0d8b 100644
+--- a/src/decoder/plugins/AdPlugDecoderPlugin.cxx
++++ b/src/decoder/plugins/AdPlugDecoderPlugin.cxx
+@@ -81,11 +81,11 @@ adplug_file_decode(DecoderClient &client, Path path_fs)
+ }
+
+ static void
+-adplug_scan_tag(TagType type, const std::string &value,
++adplug_scan_tag(TagType type, const std::string_view value,
+ TagHandler &handler) noexcept
+ {
+ if (!value.empty())
+- handler.OnTag(type, {value.data(), value.size()});
++ handler.OnTag(type, value);
+ }
+
+ static bool
+diff --git a/src/playlist/plugins/EmbeddedCuePlaylistPlugin.cxx
b/src/playlist/plugins/EmbeddedCuePlaylistPlugin.cxx
+index 57f035a6a8..7b67ea6c86 100644
+--- a/src/playlist/plugins/EmbeddedCuePlaylistPlugin.cxx
++++ b/src/playlist/plugins/EmbeddedCuePlaylistPlugin.cxx
+@@ -39,6 +39,8 @@
+
+ #include <string.h>
+
++using std::string_view_literals::operator""sv;
++
+ class EmbeddedCuePlaylist final : public SongEnumerator {
+ public:
+ /**
+@@ -69,14 +71,15 @@ class ExtractCuesheetTagHandler final : public
NullTagHandler {
+
+ ExtractCuesheetTagHandler() noexcept:NullTagHandler(WANT_PAIR) {}
+
+- void OnPair(StringView key, StringView value) noexcept override;
++ void OnPair(std::string_view key, std::string_view value) noexcept
override;
+ };
+
+ void
+-ExtractCuesheetTagHandler::OnPair(StringView name, StringView value)
noexcept
++ExtractCuesheetTagHandler::OnPair(std::string_view name, std::string_view
value) noexcept
+ {
+- if (cuesheet.empty() && name.EqualsIgnoreCase("cuesheet"))
+- cuesheet = {value.data, value.size};
++ if (cuesheet.empty() &&
++ StringView{name}.EqualsIgnoreCase("cuesheet"sv))
++ cuesheet = value;
+ }
+
+ static std::unique_ptr<SongEnumerator>
+diff --git a/src/tag/Handler.cxx b/src/tag/Handler.cxx
+index 308b38bead..b482df4efa 100644
+--- a/src/tag/Handler.cxx
++++ b/src/tag/Handler.cxx
+@@ -25,13 +25,15 @@
+
+ #include <algorithm>
+
++using std::string_view_literals::operator""sv;
++
+ void
+-NullTagHandler::OnTag(TagType, StringView) noexcept
++NullTagHandler::OnTag(TagType, std::string_view) noexcept
+ {
+ }
+
+ void
+-NullTagHandler::OnPair(StringView, StringView) noexcept
++NullTagHandler::OnPair(std::string_view, std::string_view) noexcept
+ {
+ }
+
+@@ -54,18 +56,18 @@ AddTagHandler::OnDuration(SongTime duration) noexcept
+ /**
+ * Skip leading zeroes and a non-decimal suffix.
+ */
+-static StringView
+-NormalizeDecimal(StringView s)
++static std::string_view
++NormalizeDecimal(std::string_view s)
+ {
+ auto start = std::find_if(s.begin(), s.end(),
+ [](char ch){ return ch != '0'; });
+ auto end = std::find_if(start, s.end(),
+ [](char ch){ return !IsDigitASCII(ch); });
+- return {start, end};
++ return StringView{start, end};
+ }
+
+ void
+-AddTagHandler::OnTag(TagType type, StringView value) noexcept
++AddTagHandler::OnTag(TagType type, std::string_view value) noexcept
+ {
+ if (type == TAG_TRACK || type == TAG_DISC) {
+ /* filter out this extra data and leading zeroes */
+@@ -77,9 +79,9 @@ AddTagHandler::OnTag(TagType type, StringView value)
noexcept
+ }
+
+ void
+-FullTagHandler::OnPair(StringView name, StringView) noexcept
++FullTagHandler::OnPair(std::string_view name, std::string_view) noexcept
+ {
+- if (name.EqualsIgnoreCase("cuesheet"))
++ if (StringView{name}.EqualsIgnoreCase("cuesheet"sv))
+ tag.SetHasPlaylist(true);
+ }
+
+diff --git a/src/tag/Handler.hxx b/src/tag/Handler.hxx
+index e03846903a..25600c7d16 100644
+--- a/src/tag/Handler.hxx
++++ b/src/tag/Handler.hxx
+@@ -23,9 +23,9 @@
+ #include "Type.h"
+ #include "Chrono.hxx"
+ #include "util/Compiler.h"
++#include <string_view>
+
+ template<typename T> struct ConstBuffer;
+-struct StringView;
+ struct AudioFormat;
+ class TagBuilder;
+
+@@ -83,13 +83,14 @@ public:
+ * @param the value of the tag; the pointer will become
+ * invalid after returning
+ */
+- virtual void OnTag(TagType type, StringView value) noexcept = 0;
++ virtual void OnTag(TagType type, std::string_view value) noexcept = 0;
+
+ /**
+ * A name-value pair has been read. It is the codec specific
+ * representation of tags.
+ */
+- virtual void OnPair(StringView key, StringView value) noexcept = 0;
++ virtual void OnPair(std::string_view key,
++ std::string_view value) noexcept = 0;
+
+ /**
+ * Declare the audio format of a song.
+@@ -127,8 +128,9 @@ public:
+ :TagHandler(_want_mask) {}
+
+ void OnDuration([[maybe_unused]] SongTime duration) noexcept override
{}
+- void OnTag(TagType type, StringView value) noexcept override;
+- void OnPair(StringView key, StringView value) noexcept override;
++ void OnTag(TagType type, std::string_view value) noexcept override;
++ void OnPair(std::string_view key,
++ std::string_view value) noexcept override;
+ void OnAudioFormat(AudioFormat af) noexcept override;
+ void OnPicture(const char *mime_type,
+ std::span<const std::byte> buffer) noexcept override;
+@@ -151,7 +153,7 @@ public:
+ :AddTagHandler(0, _builder) {}
+
+ void OnDuration(SongTime duration) noexcept override;
+- void OnTag(TagType type, StringView value) noexcept override;
++ void OnTag(TagType type, std::string_view value) noexcept override;
+ };
+
+ /**
+@@ -175,7 +177,8 @@ public:
+ AudioFormat *_audio_format=nullptr) noexcept
+ :FullTagHandler(0, _builder, _audio_format) {}
+
+- void OnPair(StringView key, StringView value) noexcept override;
++ void OnPair(std::string_view key,
++ std::string_view value) noexcept override;
+ void OnAudioFormat(AudioFormat af) noexcept override;
+ };
+
+diff --git a/test/read_tags.cxx b/test/read_tags.cxx
+index 0f670903ba..c2dd180c80 100644
+--- a/test/read_tags.cxx
++++ b/test/read_tags.cxx
+@@ -60,16 +60,16 @@ class DumpTagHandler final : public NullTagHandler {
+ printf("duration=%f\n", duration.ToDoubleS());
+ }
+
+- void OnTag(TagType type, StringView value) noexcept override {
++ void OnTag(TagType type, std::string_view value) noexcept override {
+ printf("[%s]=%.*s\n", tag_item_names[type],
+- int(value.size), value.data);
++ int(value.size()), value.data());
+ empty = false;
+ }
+
+- void OnPair(StringView key, StringView value) noexcept override {
++ void OnPair(std::string_view key, std::string_view value) noexcept
override {
+ printf("\"%.*s\"=%.*s\n",
+- int(key.size), key.data,
+- int(value.size), value.data);
++ int(key.size()), key.data(),
++ int(value.size()), value.data());
+ }
+
+ void OnAudioFormat(AudioFormat af) noexcept override {



  • [SM-Commit] GIT changes to master grimoire by Pavel Vinogradov (5c18819d2f7ada4a417b442eb7bfe701ea196648), Pavel Vinogradov, 05/15/2023

Archive powered by MHonArc 2.6.24.

Top of Page