aboutsummaryrefslogtreecommitdiffstats
path: root/src/db/upnp/Directory.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-10 21:10:33 +0100
committerMax Kellermann <max@duempel.org>2014-01-10 22:57:57 +0100
commit791d6c13366ac5cf43dd1d22dfa9da38f9300068 (patch)
tree9f017a9faf1e6f09998fc1936805c89c3e7cd93b /src/db/upnp/Directory.cxx
parent10abb07960071544778bb8abd1456b701834958e (diff)
downloadmpd-791d6c13366ac5cf43dd1d22dfa9da38f9300068.tar.gz
mpd-791d6c13366ac5cf43dd1d22dfa9da38f9300068.tar.xz
mpd-791d6c13366ac5cf43dd1d22dfa9da38f9300068.zip
db/upnp/Directory: eliminate struct StackEl, use std::string
Reduces bloat.
Diffstat (limited to 'src/db/upnp/Directory.cxx')
-rw-r--r--src/db/upnp/Directory.cxx17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/db/upnp/Directory.cxx b/src/db/upnp/Directory.cxx
index 1ce52aa36..4e6cd838d 100644
--- a/src/db/upnp/Directory.cxx
+++ b/src/db/upnp/Directory.cxx
@@ -53,12 +53,7 @@ ParseItemClass(const char *name)
* An XML parser which builds directory contents from DIDL lite input.
*/
class UPnPDirParser final : public CommonExpatParser {
- struct StackEl {
- StackEl(const std::string& nm) : name(nm) {}
- std::string name;
- };
-
- std::vector<StackEl> m_path;
+ std::vector<std::string> m_path;
UPnPDirObject m_tobj;
public:
@@ -71,7 +66,7 @@ public:
protected:
virtual void StartElement(const XML_Char *name, const XML_Char **attrs)
{
- m_path.push_back(StackEl(name));
+ m_path.push_back(name);
std::map<std::string,std::string> attributes;
for (int i = 0; attrs[i] != 0; i += 2)
@@ -161,19 +156,19 @@ protected:
return;
std::string str(s, len);
trimstring(str);
- switch (m_path.back().name[0]) {
+ switch (m_path.back()[0]) {
case 'd':
- if (!m_path.back().name.compare("dc:title"))
+ if (!m_path.back().compare("dc:title"))
m_tobj.m_title += str;
break;
case 'r':
- if (!m_path.back().name.compare("res")) {
+ if (!m_path.back().compare("res")) {
m_tobj.m_props["url"] += str;
}
break;
case 'u':
for (int i = 0; i < nupnptags; i++) {
- if (!m_path.back().name.compare(upnptags[i])) {
+ if (!m_path.back().compare(upnptags[i])) {
m_tobj.m_props[upnptags[i]] += str;
}
}