]> git.pld-linux.org Git - packages/mpd.git/blob - smb.patch
e10b2f373b7958797fd33c45327b420af5a281bb
[packages/mpd.git] / smb.patch
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]]
5
6 Fixes part 1 of https://github.com/MusicPlayerDaemon/MPD/issues/1279
7 ---
8  src/neighbor/plugins/SmbclientNeighborPlugin.cxx | 8 ++++----
9  1 file changed, 4 insertions(+), 4 deletions(-)
10
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 {
16  
17                 Server(const Server &) = delete;
18  
19 -               gcc_pure
20 +               [[gnu::pure]]
21                 bool operator==(const Server &other) const noexcept {
22                         return name == other.name;
23                 }
24  
25 -               [[nodiscard]] gcc_pure
26 +               [[nodiscard]] [[gnu::pure]]
27                 NeighborInfo Export() const noexcept {
28                         return { "smb://" + name + "/", comment };
29                 }
30 @@ -169,7 +169,7 @@ ReadServers(SmbclientContext &ctx, const char *uri,
31                             uri);
32  }
33  
34 -gcc_pure
35 +[[gnu::pure]]
36  static NeighborExplorer::List
37  DetectServers(SmbclientContext &ctx) noexcept
38  {
39 @@ -178,7 +178,7 @@ DetectServers(SmbclientContext &ctx) noexcept
40         return list;
41  }
42  
43 -gcc_pure
44 +[[gnu::pure]]
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()
52
53 Fixes part 2 of https://github.com/MusicPlayerDaemon/MPD/issues/1279
54 ---
55  src/neighbor/plugins/SmbclientNeighborPlugin.cxx | 6 ++++--
56  1 file changed, 4 insertions(+), 2 deletions(-)
57
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
62 @@ -33,6 +33,8 @@
63  
64  #include <libsmbclient.h>
65  
66 +#include <cerrno>
67 +#include <cstring>
68  #include <utility>
69  
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);
74         } else
75 -               FormatErrno(smbclient_domain, "smbc_opendir('%s') failed",
76 -                           uri);
77 +               FmtError(smbclient_domain, "smbc_opendir('{}') failed: {}",
78 +                        uri, strerror(errno));
79  }
80  
81  [[gnu::pure]]
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
86
87 Should have been part of commit
88 ef24cfa523b73848ba04d73154de1f95eb45a3b5
89
90 Closes https://github.com/MusicPlayerDaemon/MPD/issues/1279
91 ---
92  src/storage/plugins/SmbclientStorage.cxx | 6 +++---
93  1 file changed, 3 insertions(+), 3 deletions(-)
94
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)
102  {
103 -       if (!StringStartsWithCaseASCII(base, "smb://"))
104 -               return nullptr;
105 -
106         SmbclientInit();
107  
108         return std::make_unique<SmbclientStorage>(base);
109  }
110  
111 +static constexpr const char *smbclient_prefixes[] = { "smb://", nullptr };
112 +
113  const StoragePlugin smbclient_storage_plugin = {
114         "smbclient",
115 +       smbclient_prefixes,
116         CreateSmbclientStorageURI,
117  };
This page took 0.029284 seconds and 2 git commands to generate.