aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMario Lenz <m@riolenz.de>2009-03-17 11:36:09 +0100
committerMax Kellermann <max@duempel.org>2009-03-17 12:41:46 +0100
commit7ba7e6732382542b632840f144b4782667fc2cd9 (patch)
tree0dfa2aa6125f683c99acdc62f4b8992e5467bcc3 /src
parent2a52d495364998c6afc2f9533d0bd9965f22a291 (diff)
downloadmpd-7ba7e6732382542b632840f144b4782667fc2cd9.tar.gz
mpd-7ba7e6732382542b632840f144b4782667fc2cd9.tar.xz
mpd-7ba7e6732382542b632840f144b4782667fc2cd9.zip
flac/cue: added support for TITLE[n] comments
On 2009/03/17 Max Kellermann<max@duempel.org> wrote: > There doesn't seem to be an "official" standard. I'd say: search for > TITLE[1] first (the most explicit form), then TITLE1, and finally fall > back to TITLE. This makes sure MPD supports every possible standard, > without breaking. I've also added some additional checks to make sure entry is long enough.
Diffstat (limited to 'src')
-rw-r--r--src/decoder/_flac_common.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/decoder/_flac_common.c b/src/decoder/_flac_common.c
index 20ac01815..713dfe9b2 100644
--- a/src/decoder/_flac_common.c
+++ b/src/decoder/_flac_common.c
@@ -103,14 +103,21 @@ flac_comment_value(const FLAC__StreamMetadata_VorbisComment_Entry *entry,
const char *name, const char *char_tnum, size_t *length_r)
{
size_t name_length = strlen(name);
- size_t char_tnum_length = strlen(char_tnum);
+ size_t char_tnum_length = 0;
const char *comment = (const char*)entry->entry;
if (entry->length > name_length &&
g_ascii_strncasecmp(comment, name, name_length) == 0) {
if (char_tnum != NULL) {
char_tnum_length = strlen(char_tnum);
- if (g_ascii_strncasecmp(comment + name_length,
+ if (entry->length > name_length + char_tnum_length + 2 &&
+ comment[name_length] == '[' &&
+ g_ascii_strncasecmp(comment + name_length + 1,
+ char_tnum, char_tnum_length) == 0 &&
+ comment[name_length + char_tnum_length + 1] == ']')
+ name_length = name_length + char_tnum_length + 2;
+ else if (entry->length > name_length + char_tnum_length &&
+ g_ascii_strncasecmp(comment + name_length,
char_tnum, char_tnum_length) == 0)
name_length = name_length + char_tnum_length;
}