diff options
author | Max Kellermann <max@duempel.org> | 2014-01-10 21:24:12 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-10 22:58:37 +0100 |
commit | dadd987bf441324bf8824c16f3ac0798da652083 (patch) | |
tree | 9be28deb7ed8f56a6a01f0bdebbf3776a0e6470c /src/db | |
parent | a1ced29279b97e1165ff1a8b84bbac2860316e1a (diff) | |
download | mpd-dadd987bf441324bf8824c16f3ac0798da652083.tar.gz mpd-dadd987bf441324bf8824c16f3ac0798da652083.tar.xz mpd-dadd987bf441324bf8824c16f3ac0798da652083.zip |
db/upnp/Directory: move "res" attributes to array
Reduce bloat.
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/upnp/Directory.cxx | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/db/upnp/Directory.cxx b/src/db/upnp/Directory.cxx index 50fbb26f5..ed08eb022 100644 --- a/src/db/upnp/Directory.cxx +++ b/src/db/upnp/Directory.cxx @@ -37,6 +37,16 @@ static const char *const upnptags[] = { nullptr, }; +static const char *const res_attributes[] = { + "protocolInfo", + "size", + "bitrate", + "duration", + "sampleFrequency", + "nrAudioChannels", + nullptr, +}; + gcc_pure static UPnPDirObject::ItemClass ParseItemClass(const char *name) @@ -96,13 +106,11 @@ protected: // <res protocolInfo="http-get:*:audio/mpeg:*" size="5171496" // bitrate="24576" duration="00:03:35" sampleFrequency="44100" // nrAudioChannels="2"> - std::string s; - s="protocolInfo";m_tobj.m_props[s] = attributes[s]; - s="size";m_tobj.m_props[s] = attributes[s]; - s="bitrate";m_tobj.m_props[s] = attributes[s]; - s="duration";m_tobj.m_props[s] = attributes[s]; - s="sampleFrequency";m_tobj.m_props[s] = attributes[s]; - s="nrAudioChannels";m_tobj.m_props[s] = attributes[s]; + + for (auto i = res_attributes; *i != nullptr; ++i) { + const std::string s(*i); + m_tobj.m_props[s] = attributes[s]; + } } break; |