1 From 3f2f3251cba7b9193f39027e204ea5e3248cbb7a Mon Sep 17 00:00:00 2001
2 From: Max Kellermann <max@musicpd.org>
3 Date: Fri, 15 Oct 2021 09:39:23 +0200
4 Subject: [PATCH] neighbor/smbclient: use [[gnu::pure]]
6 Fixes part 1 of https://github.com/MusicPlayerDaemon/MPD/issues/1279
8 src/neighbor/plugins/SmbclientNeighborPlugin.cxx | 8 ++++----
9 1 file changed, 4 insertions(+), 4 deletions(-)
11 diff --git a/src/neighbor/plugins/SmbclientNeighborPlugin.cxx b/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
12 index f759e4e756..97e40e941c 100644
13 --- a/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
14 +++ b/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
15 @@ -45,12 +45,12 @@ class SmbclientNeighborExplorer final : public NeighborExplorer {
17 Server(const Server &) = delete;
21 bool operator==(const Server &other) const noexcept {
22 return name == other.name;
25 - [[nodiscard]] gcc_pure
26 + [[nodiscard]] [[gnu::pure]]
27 NeighborInfo Export() const noexcept {
28 return { "smb://" + name + "/", comment };
30 @@ -169,7 +169,7 @@ ReadServers(SmbclientContext &ctx, const char *uri,
36 static NeighborExplorer::List
37 DetectServers(SmbclientContext &ctx) noexcept
39 @@ -178,7 +178,7 @@ DetectServers(SmbclientContext &ctx) noexcept
45 static NeighborExplorer::List::iterator
46 FindBeforeServerByURI(NeighborExplorer::List::iterator prev,
47 NeighborExplorer::List::iterator end,
48 From 466b5cb08d5385f54dda07b4eead668b39685a83 Mon Sep 17 00:00:00 2001
49 From: Max Kellermann <max@musicpd.org>
50 Date: Fri, 15 Oct 2021 09:40:27 +0200
51 Subject: [PATCH] neighbor/smbclient: FmtError() instead of FormatErrno()
53 Fixes part 2 of https://github.com/MusicPlayerDaemon/MPD/issues/1279
55 src/neighbor/plugins/SmbclientNeighborPlugin.cxx | 6 ++++--
56 1 file changed, 4 insertions(+), 2 deletions(-)
58 diff --git a/src/neighbor/plugins/SmbclientNeighborPlugin.cxx b/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
59 index 97e40e941..144059f50 100644
60 --- a/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
61 +++ b/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
64 #include <libsmbclient.h>
70 class SmbclientNeighborExplorer final : public NeighborExplorer {
71 @@ -165,8 +167,8 @@ ReadServers(SmbclientContext &ctx, const char *uri,
72 ReadServers(ctx, handle, list);
73 ctx.CloseDirectory(handle);
75 - FormatErrno(smbclient_domain, "smbc_opendir('%s') failed",
77 + FmtError(smbclient_domain, "smbc_opendir('{}') failed: {}",
78 + uri, strerror(errno));
82 From 85611aa456cddb38cd8163a35bac6b6fa5c8fd98 Mon Sep 17 00:00:00 2001
83 From: Max Kellermann <max@musicpd.org>
84 Date: Fri, 15 Oct 2021 10:23:58 +0200
85 Subject: [PATCH] storage/smbclient: add StoragePlugin.prefixes
87 Should have been part of commit
88 ef24cfa523b73848ba04d73154de1f95eb45a3b5
90 Closes https://github.com/MusicPlayerDaemon/MPD/issues/1279
92 src/storage/plugins/SmbclientStorage.cxx | 6 +++---
93 1 file changed, 3 insertions(+), 3 deletions(-)
95 diff --git a/src/storage/plugins/SmbclientStorage.cxx b/src/storage/plugins/SmbclientStorage.cxx
96 index 72eb4820c2..a033f3d7f8 100644
97 --- a/src/storage/plugins/SmbclientStorage.cxx
98 +++ b/src/storage/plugins/SmbclientStorage.cxx
99 @@ -186,15 +186,15 @@ SmbclientDirectoryReader::GetInfo([[maybe_unused]] bool follow)
100 static std::unique_ptr<Storage>
101 CreateSmbclientStorageURI([[maybe_unused]] EventLoop &event_loop, const char *base)
103 - if (!StringStartsWithCaseASCII(base, "smb://"))
108 return std::make_unique<SmbclientStorage>(base);
111 +static constexpr const char *smbclient_prefixes[] = { "smb://", nullptr };
113 const StoragePlugin smbclient_storage_plugin = {
115 + smbclient_prefixes,
116 CreateSmbclientStorageURI,