summaryrefslogtreecommitdiff
path: root/src/lib/upnp
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-01-02 13:11:00 +0100
committerMax Kellermann <max@musicpd.org>2018-01-02 14:16:57 +0100
commitcdf615f7836a955223cf7e6df697c525924bd9b3 (patch)
treedb3809458220d1f2c220f9934bc5b7bef1844d5c /src/lib/upnp
parent7d96883d64f71596ae3eec644dcb14a72a9c67d9 (diff)
lib/upnp/ContentDirectoryService: use SplitString() instead of csvToStrings()
Diffstat (limited to 'src/lib/upnp')
-rw-r--r--src/lib/upnp/ContentDirectoryService.cxx13
-rw-r--r--src/lib/upnp/ContentDirectoryService.hxx4
2 files changed, 6 insertions, 11 deletions
diff --git a/src/lib/upnp/ContentDirectoryService.cxx b/src/lib/upnp/ContentDirectoryService.cxx
index 2dc3eded4..b8e9efd44 100644
--- a/src/lib/upnp/ContentDirectoryService.cxx
+++ b/src/lib/upnp/ContentDirectoryService.cxx
@@ -22,10 +22,10 @@
#include "UniqueIxml.hxx"
#include "Device.hxx"
#include "ixmlwrap.hxx"
-#include "Util.hxx"
#include "Action.hxx"
#include "util/UriUtil.hxx"
#include "util/RuntimeError.hxx"
+#include "util/SplitString.hxx"
ContentDirectoryService::ContentDirectoryService(const UPnPDevice &device,
const UPnPService &service) noexcept
@@ -49,7 +49,7 @@ ContentDirectoryService::~ContentDirectoryService() noexcept
/* this destructor exists here just so it won't get inlined */
}
-std::list<std::string>
+std::forward_list<std::string>
ContentDirectoryService::getSearchCapabilities(UpnpClient_Handle hdl) const
{
UniqueIxmlDocument request(UpnpMakeAction("GetSearchCapabilities", m_serviceType.c_str(),
@@ -68,15 +68,10 @@ ContentDirectoryService::getSearchCapabilities(UpnpClient_Handle hdl) const
UniqueIxmlDocument response(_response);
- std::list<std::string> result;
-
const char *s = ixmlwrap::getFirstElementValue(response.get(),
"SearchCaps");
if (s == nullptr || *s == 0)
- return result;
-
- if (!csvToStrings(s, result))
- throw std::runtime_error("Bad response");
+ return {};
- return result;
+ return SplitString(s, ',', false);
}
diff --git a/src/lib/upnp/ContentDirectoryService.hxx b/src/lib/upnp/ContentDirectoryService.hxx
index cefb208c1..55fae6a56 100644
--- a/src/lib/upnp/ContentDirectoryService.hxx
+++ b/src/lib/upnp/ContentDirectoryService.hxx
@@ -25,7 +25,7 @@
#include <upnp.h>
#include <string>
-#include <list>
+#include <forward_list>
class UPnPDevice;
struct UPnPService;
@@ -111,7 +111,7 @@ public:
* @param[out] result an empty vector: no search, or a single '*' element:
* any tag can be used in a search, or a list of usable tag names.
*/
- std::list<std::string> getSearchCapabilities(UpnpClient_Handle handle) const;
+ std::forward_list<std::string> getSearchCapabilities(UpnpClient_Handle handle) const;
gcc_pure
std::string GetURI() const noexcept {