diff options
author | Max Kellermann <max@duempel.org> | 2013-12-03 11:31:03 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-12-03 11:46:26 +0100 |
commit | 923f18ef76a2a15d1451e97a9437b70bb38eefb3 (patch) | |
tree | ded7785e11e79979e57fc5c0af740c6ac2e8ca11 | |
parent | 7e8d254b95716f1253577a9a5d7df1760f9f6e47 (diff) | |
download | mpd-923f18ef76a2a15d1451e97a9437b70bb38eefb3.tar.gz mpd-923f18ef76a2a15d1451e97a9437b70bb38eefb3.tar.xz mpd-923f18ef76a2a15d1451e97a9437b70bb38eefb3.zip |
IcyMetaDataParser: use class TagBuilder
-rw-r--r-- | src/IcyMetaDataParser.cxx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/IcyMetaDataParser.cxx b/src/IcyMetaDataParser.cxx index 8861efb2e..6beeddd31 100644 --- a/src/IcyMetaDataParser.cxx +++ b/src/IcyMetaDataParser.cxx @@ -20,6 +20,7 @@ #include "config.h" #include "IcyMetaDataParser.hxx" #include "tag/Tag.hxx" +#include "tag/TagBuilder.hxx" #include "util/Domain.hxx" #include "Log.hxx" @@ -66,7 +67,7 @@ IcyMetaDataParser::Data(size_t length) } static void -icy_add_item(Tag &tag, TagType type, const char *value) +icy_add_item(TagBuilder &tag, TagType type, const char *value) { size_t length = strlen(value); @@ -81,7 +82,7 @@ icy_add_item(Tag &tag, TagType type, const char *value) } static void -icy_parse_tag_item(Tag &tag, const char *item) +icy_parse_tag_item(TagBuilder &tag, const char *item) { gchar **p = g_strsplit(item, "=", 0); @@ -99,15 +100,16 @@ icy_parse_tag_item(Tag &tag, const char *item) static Tag * icy_parse_tag(const char *p) { - Tag *tag = new Tag(); + TagBuilder tag; + gchar **items = g_strsplit(p, ";", 0); for (unsigned i = 0; items[i] != nullptr; ++i) - icy_parse_tag_item(*tag, items[i]); + icy_parse_tag_item(tag, items[i]); g_strfreev(items); - return tag; + return tag.Commit(); } size_t |