lib/upnp/ContentDirectoryService: use SplitString() instead of csvToStrings()

This commit is contained in:
Max Kellermann 2018-01-02 13:11:00 +01:00
parent 7d96883d64
commit cdf615f783
2 changed files with 6 additions and 11 deletions

View File

@ -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;
return {};
if (!csvToStrings(s, result))
throw std::runtime_error("Bad response");
return result;
return SplitString(s, ',', false);
}

View File

@ -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 {