This commit is contained in:
4fury-c3440d8
2022-05-14 06:23:14 +03:00
parent 4a1e51f43b
commit 13f1347d04
7 changed files with 20 additions and 146 deletions
@@ -1,34 +0,0 @@
From 466b5cb08d5385f54dda07b4eead668b39685a83 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Fri, 15 Oct 2021 09:40:27 +0200
Subject: [PATCH] neighbor/smbclient: FmtError() instead of FormatErrno()
Fixes part 2 of https://github.com/MusicPlayerDaemon/MPD/issues/1279
---
src/neighbor/plugins/SmbclientNeighborPlugin.cxx | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/neighbor/plugins/SmbclientNeighborPlugin.cxx b/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
index 97e40e941..144059f50 100644
--- a/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
+++ b/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
@@ -33,6 +33,8 @@
#include <libsmbclient.h>
+#include <cerrno>
+#include <cstring>
#include <utility>
class SmbclientNeighborExplorer final : public NeighborExplorer {
@@ -165,8 +167,8 @@ ReadServers(SmbclientContext &ctx, const char *uri,
ReadServers(ctx, handle, list);
ctx.CloseDirectory(handle);
} else
- FormatErrno(smbclient_domain, "smbc_opendir('%s') failed",
- uri);
+ FmtError(smbclient_domain, "smbc_opendir('{}') failed: {}",
+ uri, strerror(errno));
}
[[gnu::pure]]
@@ -1,36 +0,0 @@
From 85611aa456cddb38cd8163a35bac6b6fa5c8fd98 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Fri, 15 Oct 2021 10:23:58 +0200
Subject: [PATCH] storage/smbclient: add StoragePlugin.prefixes
Should have been part of commit
ef24cfa523b73848ba04d73154de1f95eb45a3b5
Closes https://github.com/MusicPlayerDaemon/MPD/issues/1279
---
src/storage/plugins/SmbclientStorage.cxx | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/storage/plugins/SmbclientStorage.cxx b/src/storage/plugins/SmbclientStorage.cxx
index 72eb4820c2..a033f3d7f8 100644
--- a/src/storage/plugins/SmbclientStorage.cxx
+++ b/src/storage/plugins/SmbclientStorage.cxx
@@ -186,15 +186,15 @@ SmbclientDirectoryReader::GetInfo([[maybe_unused]] bool follow)
static std::unique_ptr<Storage>
CreateSmbclientStorageURI([[maybe_unused]] EventLoop &event_loop, const char *base)
{
- if (!StringStartsWithCaseASCII(base, "smb://"))
- return nullptr;
-
SmbclientInit();
return std::make_unique<SmbclientStorage>(base);
}
+static constexpr const char *smbclient_prefixes[] = { "smb://", nullptr };
+
const StoragePlugin smbclient_storage_plugin = {
"smbclient",
+ smbclient_prefixes,
CreateSmbclientStorageURI,
};
@@ -1,23 +0,0 @@
From 6a2e7bbc02c0f1b1ee404b13b5035d4027abd506 Mon Sep 17 00:00:00 2001
From: Thomas Zander <thomas.e.zander@googlemail.com>
Date: Sat, 16 Oct 2021 17:36:56 +0200
Subject: [PATCH] protocol/ArgParser.cxx: Add missing #include <stdio.h>
Fixes a build problem on platforms where stdio.h is not included
transitively. snprintf() is defined in stdio.h.
---
src/protocol/ArgParser.cxx | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/protocol/ArgParser.cxx b/src/protocol/ArgParser.cxx
index 123182f72..72190d9de 100644
--- a/src/protocol/ArgParser.cxx
+++ b/src/protocol/ArgParser.cxx
@@ -23,6 +23,7 @@
#include "Chrono.hxx"
#include "util/NumberParser.hxx"
+#include <stdio.h>
#include <stdlib.h>
static inline ProtocolError
@@ -1,47 +0,0 @@
From 3f2f3251cba7b9193f39027e204ea5e3248cbb7a Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Fri, 15 Oct 2021 09:39:23 +0200
Subject: [PATCH] neighbor/smbclient: use [[gnu::pure]]
Fixes part 1 of https://github.com/MusicPlayerDaemon/MPD/issues/1279
---
src/neighbor/plugins/SmbclientNeighborPlugin.cxx | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/neighbor/plugins/SmbclientNeighborPlugin.cxx b/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
index f759e4e756..97e40e941c 100644
--- a/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
+++ b/src/neighbor/plugins/SmbclientNeighborPlugin.cxx
@@ -45,12 +45,12 @@ class SmbclientNeighborExplorer final : public NeighborExplorer {
Server(const Server &) = delete;
- gcc_pure
+ [[gnu::pure]]
bool operator==(const Server &other) const noexcept {
return name == other.name;
}
- [[nodiscard]] gcc_pure
+ [[nodiscard]] [[gnu::pure]]
NeighborInfo Export() const noexcept {
return { "smb://" + name + "/", comment };
}
@@ -169,7 +169,7 @@ ReadServers(SmbclientContext &ctx, const char *uri,
uri);
}
-gcc_pure
+[[gnu::pure]]
static NeighborExplorer::List
DetectServers(SmbclientContext &ctx) noexcept
{
@@ -178,7 +178,7 @@ DetectServers(SmbclientContext &ctx) noexcept
return list;
}
-gcc_pure
+[[gnu::pure]]
static NeighborExplorer::List::iterator
FindBeforeServerByURI(NeighborExplorer::List::iterator prev,
NeighborExplorer::List::iterator end,