IcyMetaDataParser: use class TagBuilder

This commit is contained in:
Max Kellermann 2013-12-03 11:31:03 +01:00
parent 7e8d254b95
commit 923f18ef76

View File

@ -20,6 +20,7 @@
#include "config.h" #include "config.h"
#include "IcyMetaDataParser.hxx" #include "IcyMetaDataParser.hxx"
#include "tag/Tag.hxx" #include "tag/Tag.hxx"
#include "tag/TagBuilder.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "Log.hxx" #include "Log.hxx"
@ -66,7 +67,7 @@ IcyMetaDataParser::Data(size_t length)
} }
static void 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); size_t length = strlen(value);
@ -81,7 +82,7 @@ icy_add_item(Tag &tag, TagType type, const char *value)
} }
static void 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); gchar **p = g_strsplit(item, "=", 0);
@ -99,15 +100,16 @@ icy_parse_tag_item(Tag &tag, const char *item)
static Tag * static Tag *
icy_parse_tag(const char *p) icy_parse_tag(const char *p)
{ {
Tag *tag = new Tag(); TagBuilder tag;
gchar **items = g_strsplit(p, ";", 0); gchar **items = g_strsplit(p, ";", 0);
for (unsigned i = 0; items[i] != nullptr; ++i) 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); g_strfreev(items);
return tag; return tag.Commit();
} }
size_t size_t