aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/VorbisComments.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/decoder/VorbisComments.cxx20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/decoder/VorbisComments.cxx b/src/decoder/VorbisComments.cxx
index d4f019b58..e6a99ca6b 100644
--- a/src/decoder/VorbisComments.cxx
+++ b/src/decoder/VorbisComments.cxx
@@ -20,16 +20,13 @@
#include "config.h"
#include "VorbisComments.hxx"
#include "XiphTags.hxx"
-#include "tag/Tag.hxx"
#include "tag/TagTable.hxx"
#include "tag/TagHandler.hxx"
#include "tag/TagBuilder.hxx"
#include "ReplayGainInfo.hxx"
#include "util/ASCII.hxx"
+#include "util/SplitString.hxx"
-#include <glib.h>
-
-#include <assert.h>
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
@@ -104,16 +101,11 @@ vorbis_scan_comment(const char *comment,
const struct tag_handler *handler, void *handler_ctx)
{
if (handler->pair != nullptr) {
- char *name = g_strdup((const char*)comment);
- char *value = strchr(name, '=');
-
- if (value != nullptr && value > name) {
- *value++ = 0;
+ const SplitString split(comment, '=');
+ if (split.IsDefined() && !split.IsEmpty())
tag_handler_invoke_pair(handler, handler_ctx,
- name, value);
- }
-
- g_free(name);
+ split.GetFirst(),
+ split.GetSecond());
}
for (const struct tag_table *i = xiph_tags; i->name != nullptr; ++i)
@@ -145,5 +137,5 @@ vorbis_comments_to_tag(char **comments)
vorbis_comments_scan(comments, &add_tag_handler, &tag_builder);
return tag_builder.IsEmpty()
? nullptr
- : tag_builder.Commit();
+ : tag_builder.CommitNew();
}