diff options
author | Max Kellermann <max@duempel.org> | 2013-07-30 20:11:57 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-07-30 20:19:53 +0200 |
commit | 06f898cc1240a29b293de0e97ad95a4fdc971254 (patch) | |
tree | 001a6d3db039cdc03323f3bfddc13b94bde31ce4 /src/IcyMetaDataParser.cxx | |
parent | 6a9ab8bc0e2f5d34803513bb2d94d041a607a58c (diff) | |
download | mpd-06f898cc1240a29b293de0e97ad95a4fdc971254.tar.gz mpd-06f898cc1240a29b293de0e97ad95a4fdc971254.tar.xz mpd-06f898cc1240a29b293de0e97ad95a4fdc971254.zip |
tag: convert to C++
Diffstat (limited to '')
-rw-r--r-- | src/IcyMetaDataParser.cxx | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/IcyMetaDataParser.cxx b/src/IcyMetaDataParser.cxx index cda63da44..6e1e18a51 100644 --- a/src/IcyMetaDataParser.cxx +++ b/src/IcyMetaDataParser.cxx @@ -19,7 +19,7 @@ #include "config.h" #include "IcyMetaDataParser.hxx" -#include "tag.h" +#include "Tag.hxx" #include <glib.h> @@ -38,8 +38,7 @@ IcyMetaDataParser::Reset() if (data_rest == 0 && meta_size > 0) g_free(meta_data); - if (tag != nullptr) - tag_free(tag); + delete tag; data_rest = data_size; meta_size = 0; @@ -66,7 +65,7 @@ IcyMetaDataParser::Data(size_t length) } static void -icy_add_item(struct tag *tag, enum tag_type type, const char *value) +icy_add_item(Tag &tag, enum tag_type type, const char *value) { size_t length = strlen(value); @@ -77,11 +76,11 @@ icy_add_item(struct tag *tag, enum tag_type type, const char *value) } if (length > 0) - tag_add_item_n(tag, type, value, length); + tag.AddItem(type, value, length); } static void -icy_parse_tag_item(struct tag *tag, const char *item) +icy_parse_tag_item(Tag &tag, const char *item) { gchar **p = g_strsplit(item, "=", 0); @@ -95,14 +94,14 @@ icy_parse_tag_item(struct tag *tag, const char *item) g_strfreev(p); } -static struct tag * +static Tag * icy_parse_tag(const char *p) { - struct tag *tag = tag_new(); + Tag *tag = new 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); @@ -157,8 +156,7 @@ IcyMetaDataParser::Meta(const void *data, size_t length) /* parse */ - if (tag != nullptr) - tag_free(tag); + delete tag; tag = icy_parse_tag(meta_data); g_free(meta_data); |