summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/metadata/id3tags.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/apps/metadata/id3tags.c b/apps/metadata/id3tags.c
index ba6a158080..3cbebc12e3 100644
--- a/apps/metadata/id3tags.c
+++ b/apps/metadata/id3tags.c
@@ -357,27 +357,32 @@ static int parseuser( struct mp3entry* entry, char* tag, int bufferpos )
357{ 357{
358 char* value = NULL; 358 char* value = NULL;
359 int desc_len = strlen(tag); 359 int desc_len = strlen(tag);
360 int value_len = 0; 360 int length = 0;
361 361
362 if ((tag - entry->id3v2buf + desc_len + 2) < bufferpos) { 362 if ((tag - entry->id3v2buf + desc_len + 2) < bufferpos) {
363 /* At least part of the value was read, so we can safely try to 363 /* At least part of the value was read, so we can safely try to
364 * parse it */ 364 * parse it */
365 value = tag + desc_len + 1; 365 value = tag + desc_len + 1;
366 value_len = strlen(value) + 1;
367 366
368 if (!strcasecmp(tag, "ALBUM ARTIST")) { 367 if (!strcasecmp(tag, "ALBUM ARTIST")) {
369 strlcpy(tag, value, value_len); 368 length = strlen(value) + 1;
369 strlcpy(tag, value, length);
370 entry->albumartist = tag; 370 entry->albumartist = tag;
371#if CONFIG_CODEC == SWCODEC 371#if CONFIG_CODEC == SWCODEC
372 } else { 372 } else {
373 value_len = parse_replaygain(tag, value, entry, tag, value_len); 373 /* Calculate residual buffer size in bytes which can be used by
374#else 374 * parse_replaygain() to save the string representation of
375 value_len = 0; 375 * replaygain data.*/
376 length = sizeof(entry->id3v2buf) - (tag - entry->id3v2buf);
377
378 /* Call parse_replaygain(), returns length in bytes used by the
379 * string representation of replaygain data. */
380 length = parse_replaygain(tag, value, entry, tag, length);
376#endif 381#endif
377 } 382 }
378 } 383 }
379 384
380 return tag - entry->id3v2buf + value_len; 385 return tag - entry->id3v2buf + length;
381} 386}
382 387
383#if CONFIG_CODEC == SWCODEC 388#if CONFIG_CODEC == SWCODEC