Commit 25cf3333 authored by Max Kellermann's avatar Max Kellermann

oggvorbis: use vorbis_comment_value() in vorbis_parse_comment()

Eliminate some duplicate code.
parent 5a26c949
...@@ -144,8 +144,7 @@ static const char *VORBIS_COMMENT_DISC_KEY = "discnumber"; ...@@ -144,8 +144,7 @@ static const char *VORBIS_COMMENT_DISC_KEY = "discnumber";
static bool static bool
vorbis_parse_comment(struct tag *tag, char *comment, enum tag_type tag_type) vorbis_parse_comment(struct tag *tag, char *comment, enum tag_type tag_type)
{ {
const char *needle; const char *needle, *value;
unsigned int len;
assert(tag != NULL); assert(tag != NULL);
...@@ -159,10 +158,10 @@ vorbis_parse_comment(struct tag *tag, char *comment, enum tag_type tag_type) ...@@ -159,10 +158,10 @@ vorbis_parse_comment(struct tag *tag, char *comment, enum tag_type tag_type)
default: default:
needle = mpdTagItemKeys[tag_type]; needle = mpdTagItemKeys[tag_type];
} }
len = strlen(needle);
if (strncasecmp(comment, needle, len) == 0 && *(comment + len) == '=') { value = vorbis_comment_value(comment, needle);
tag_add_item(tag, tag_type, comment + len + 1); if (value != NULL) {
tag_add_item(tag, tag_type, value);
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment