diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx index 571f460f3..9c030161a 100644 --- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx +++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx @@ -591,7 +591,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection, { DatabaseVisitorHelper helper(CheckSelection(selection), visit_song); - auto vpath = SplitString(selection.uri.c_str(), '/'); + auto vpath = SplitString(selection.uri, '/'); if (vpath.empty()) { for (const auto &server : discovery->GetDirectories()) { if (visit_directory) { diff --git a/src/util/SplitString.cxx b/src/util/SplitString.cxx index 650c6e58e..5676b098f 100644 --- a/src/util/SplitString.cxx +++ b/src/util/SplitString.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2016 Max Kellermann + * Copyright 2013-2020 Max Kellermann * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,13 +32,14 @@ #include "StringStrip.hxx" std::forward_list -SplitString(const char *s, char separator, bool strip) noexcept +SplitString(std::string_view _s, char separator, bool strip) noexcept { + StringView s(_s); if (strip) - s = StripLeft(s); + s.StripLeft(); std::forward_list list; - if (*s == 0) + if (s.empty()) return list; auto i = list.before_begin(); diff --git a/src/util/SplitString.hxx b/src/util/SplitString.hxx index c22175f2f..7ecc8997e 100644 --- a/src/util/SplitString.hxx +++ b/src/util/SplitString.hxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013-2016 Max Kellermann + * Copyright 2013-2020 Max Kellermann * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,6 +32,7 @@ #include #include +#include /** * Split a string at a certain separator character into sub strings @@ -44,6 +45,6 @@ * (and not a list with an empty string). */ std::forward_list -SplitString(const char *s, char separator, bool strip=true) noexcept; +SplitString(std::string_view s, char separator, bool strip=true) noexcept; #endif