summaryrefslogtreecommitdiffstats
path: root/apps/metadata/mp3.c
diff options
context:
space:
mode:
authorRobert Keevil <rkeevil+rockbox@gmail.com>2009-04-16 23:10:45 +0000
committerRobert Keevil <rkeevil+rockbox@gmail.com>2009-04-16 23:10:45 +0000
commit4f47b3893838c8da9bea25078dc35e93d1d6df27 (patch)
treee069efcff0f1b9dc2ec777d50800b5ec8677a62a /apps/metadata/mp3.c
parent8d24f97c2c6990132bccb3a753007e3b7c004826 (diff)
downloadrockbox-4f47b3893838c8da9bea25078dc35e93d1d6df27.tar.gz
rockbox-4f47b3893838c8da9bea25078dc35e93d1d6df27.zip
Fix reading of Musicbrainz track IDs from ID3 tags - incorrect return values resulted in these tags being partially overwritten
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20719 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/metadata/mp3.c')
-rw-r--r--apps/metadata/mp3.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/apps/metadata/mp3.c b/apps/metadata/mp3.c
index 86a6f6329b..d3adc5d6ae 100644
--- a/apps/metadata/mp3.c
+++ b/apps/metadata/mp3.c
@@ -398,7 +398,8 @@ static int parsembtid( struct mp3entry* entry, char* tag, int bufferpos )
char* value = NULL;
int desc_len = strlen(tag);
/*DEBUGF("MBID len: %d\n", desc_len);*/
- int value_len = 0;
+ /* Musicbrainz track IDs are always 36 chars long */
+ const size_t mbtid_len = 36;
if ((tag - entry->id3v2buf + desc_len + 2) < bufferpos)
{
@@ -406,16 +407,15 @@ static int parsembtid( struct mp3entry* entry, char* tag, int bufferpos )
if (strcasecmp(tag, "http://musicbrainz.org") == 0)
{
- /* Musicbrainz track IDs are always 36 chars long plus null */
- value_len = 37;
-
- entry->mb_track_id = value;
-
- /*DEBUGF("ENTRY: %s LEN: %d\n", entry->mb_track_id, strlen(entry->mb_track_id));*/
+ if (mbtid_len == strlen(value))
+ {
+ entry->mb_track_id = value;
+ return bufferpos + mbtid_len + 1;
+ }
}
}
- return tag - entry->id3v2buf + value_len;
+ return bufferpos;
}
static const struct tag_resolver taglist[] = {