diff options
author | Max Kellermann <max@duempel.org> | 2014-01-22 19:29:03 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-22 19:38:02 +0100 |
commit | 9aeb23dfe906ae22dd340f42930c7961f810e9cc (patch) | |
tree | c00052c95fcb8d036daf2b2c502ed2015a43169a | |
parent | e59d8c9378d8bdf1fcd60b26b366eae11559ee17 (diff) | |
download | mpd-9aeb23dfe906ae22dd340f42930c7961f810e9cc.tar.gz mpd-9aeb23dfe906ae22dd340f42930c7961f810e9cc.tar.xz mpd-9aeb23dfe906ae22dd340f42930c7961f810e9cc.zip |
db/upnp/Util: use string::back(), string::front()
-rw-r--r-- | src/db/upnp/Util.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/db/upnp/Util.cxx b/src/db/upnp/Util.cxx index 76710c9ab..86c9a65ab 100644 --- a/src/db/upnp/Util.cxx +++ b/src/db/upnp/Util.cxx @@ -46,11 +46,11 @@ std::string caturl(const std::string &s1, const std::string &s2) { std::string out(s1); - if (out[out.size()-1] == '/') { - if (s2[0] == '/') + if (out.back() == '/') { + if (s2.front() == '/') out.erase(out.size()-1); } else { - if (s2[0] != '/') + if (s2.front() != '/') out.push_back('/'); } out += s2; @@ -60,7 +60,7 @@ caturl(const std::string &s1, const std::string &s2) static void path_catslash(std::string &s) { - if (s.empty() || s[s.length() - 1] != '/') + if (s.empty() || s.back() != '/') s += '/'; } @@ -73,7 +73,7 @@ path_getfather(const std::string &s) if (father.empty()) return "./"; - if (father[father.length() - 1] == '/') { + if (father.back() == '/') { // Input ends with /. Strip it, handle special case for root if (father.length() == 1) return father; |