lib/upnp/Util: remove parameter "skipinit", always true

This commit is contained in:
Max Kellermann 2017-01-23 19:28:07 +01:00
parent 678524ad21
commit d3013d4f8c
3 changed files with 6 additions and 7 deletions

View File

@ -180,7 +180,7 @@ UpnpDatabase::ReturnSong(const LightSong *_song) const
const LightSong * const LightSong *
UpnpDatabase::GetSong(const char *uri) const UpnpDatabase::GetSong(const char *uri) const
{ {
auto vpath = stringToTokens(uri, "/", true); auto vpath = stringToTokens(uri, "/");
if (vpath.size() < 2) if (vpath.size() < 2)
throw DatabaseError(DatabaseErrorCode::NOT_FOUND, throw DatabaseError(DatabaseErrorCode::NOT_FOUND,
"No such song"); "No such song");
@ -577,7 +577,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection,
VisitSong visit_song, VisitSong visit_song,
VisitPlaylist visit_playlist) const VisitPlaylist visit_playlist) const
{ {
auto vpath = stringToTokens(selection.uri, "/", true); auto vpath = stringToTokens(selection.uri, "/");
if (vpath.empty()) { if (vpath.empty()) {
for (const auto &server : discovery->GetDirectories()) { for (const auto &server : discovery->GetDirectories()) {
if (visit_directory) { if (visit_directory) {

View File

@ -71,15 +71,14 @@ path_getfather(const std::string &s)
std::list<std::string> std::list<std::string>
stringToTokens(const std::string &str, stringToTokens(const std::string &str,
const char *delims, bool skipinit) const char *delims)
{ {
std::list<std::string> tokens; std::list<std::string> 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. // Skip initial delims, return empty if this eats all.
if (skipinit && if (startPos == std::string::npos)
(startPos = str.find_first_not_of(delims, 0)) == std::string::npos)
return tokens; return tokens;
while (startPos < str.size()) { while (startPos < str.size()) {

View File

@ -34,7 +34,7 @@ path_getfather(const std::string &s);
gcc_pure gcc_pure
std::list<std::string> std::list<std::string>
stringToTokens(const std::string &str, stringToTokens(const std::string &str,
const char *delims = "/", bool skipinit = true); const char *delims = "/");
template <class T> template <class T>
bool bool