diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx index 3ac4b4f86..45a402e0d 100644 --- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx +++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx @@ -180,7 +180,7 @@ UpnpDatabase::ReturnSong(const LightSong *_song) const const LightSong * UpnpDatabase::GetSong(const char *uri) const { - auto vpath = stringToTokens(uri, "/", true); + auto vpath = stringToTokens(uri, "/"); if (vpath.size() < 2) throw DatabaseError(DatabaseErrorCode::NOT_FOUND, "No such song"); @@ -577,7 +577,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection, VisitSong visit_song, VisitPlaylist visit_playlist) const { - auto vpath = stringToTokens(selection.uri, "/", true); + auto vpath = stringToTokens(selection.uri, "/"); if (vpath.empty()) { for (const auto &server : discovery->GetDirectories()) { if (visit_directory) { diff --git a/src/lib/upnp/Util.cxx b/src/lib/upnp/Util.cxx index faac27a5e..f433af6f1 100644 --- a/src/lib/upnp/Util.cxx +++ b/src/lib/upnp/Util.cxx @@ -71,15 +71,14 @@ path_getfather(const std::string &s) std::list stringToTokens(const std::string &str, - const char *delims, bool skipinit) + const char *delims) { std::list tokens; - std::string::size_type startPos = 0; + std::string::size_type startPos = str.find_first_not_of(delims, 0); // Skip initial delims, return empty if this eats all. - if (skipinit && - (startPos = str.find_first_not_of(delims, 0)) == std::string::npos) + if (startPos == std::string::npos) return tokens; while (startPos < str.size()) { diff --git a/src/lib/upnp/Util.hxx b/src/lib/upnp/Util.hxx index 7fe6abbcc..4123a076d 100644 --- a/src/lib/upnp/Util.hxx +++ b/src/lib/upnp/Util.hxx @@ -34,7 +34,7 @@ path_getfather(const std::string &s); gcc_pure std::list stringToTokens(const std::string &str, - const char *delims = "/", bool skipinit = true); + const char *delims = "/"); template bool