From 26b850c15c605b4fc1404c4e8683791603f0e43c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 14 Jan 2014 12:15:21 +0100 Subject: db/upnp: use std::replace() in titleToPath() --- src/db/UpnpDatabasePlugin.cxx | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/db/UpnpDatabasePlugin.cxx b/src/db/UpnpDatabasePlugin.cxx index d39bcdec9..ca7bebc0e 100644 --- a/src/db/UpnpDatabasePlugin.cxx +++ b/src/db/UpnpDatabasePlugin.cxx @@ -40,6 +40,7 @@ #include "Log.hxx" #include "SongFilter.hxx" +#include #include #include #include @@ -216,17 +217,10 @@ UpnpDatabase::ReturnSong(Song *song) const */ gcc_pure static std::string -titleToPathElt(const std::string &in) +titleToPathElt(std::string s) { - std::string out; - for (auto it = in.begin(); it != in.end(); it++) { - if (*it == '/') { - out += '_'; - } else { - out += *it; - } - } - return out; + std::replace(s.begin(), s.end(), '/', '_'); + return s; } // If uri is empty, we use the object's url instead. This happens -- cgit v1.2.3