diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/metadata/id3tags.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/apps/metadata/id3tags.c b/apps/metadata/id3tags.c index 9143f8ad25..ba6a158080 100644 --- a/apps/metadata/id3tags.c +++ b/apps/metadata/id3tags.c | |||
@@ -266,6 +266,9 @@ static int parseyearnum( struct mp3entry* entry, char* tag, int bufferpos ) | |||
266 | /* parse numeric genre from string, version 2.2 and 2.3 */ | 266 | /* parse numeric genre from string, version 2.2 and 2.3 */ |
267 | static int parsegenre( struct mp3entry* entry, char* tag, int bufferpos ) | 267 | static int parsegenre( struct mp3entry* entry, char* tag, int bufferpos ) |
268 | { | 268 | { |
269 | /* Use bufferpos to hold current position in entry->id3v2buf. */ | ||
270 | bufferpos = tag - entry->id3v2buf; | ||
271 | |||
269 | if(entry->id3version >= ID3_VER_2_4) { | 272 | if(entry->id3version >= ID3_VER_2_4) { |
270 | /* In version 2.4 and up, there are no parentheses, and the genre frame | 273 | /* In version 2.4 and up, there are no parentheses, and the genre frame |
271 | is a list of strings, either numbers or text. */ | 274 | is a list of strings, either numbers or text. */ |
@@ -273,19 +276,19 @@ static int parsegenre( struct mp3entry* entry, char* tag, int bufferpos ) | |||
273 | /* Is it a number? */ | 276 | /* Is it a number? */ |
274 | if(isdigit(tag[0])) { | 277 | if(isdigit(tag[0])) { |
275 | entry->genre_string = id3_get_num_genre(atoi( tag )); | 278 | entry->genre_string = id3_get_num_genre(atoi( tag )); |
276 | return tag - entry->id3v2buf; | 279 | return bufferpos; |
277 | } else { | 280 | } else { |
278 | entry->genre_string = tag; | 281 | entry->genre_string = tag; |
279 | return bufferpos; | 282 | return bufferpos + strlen(tag) + 1; |
280 | } | 283 | } |
281 | } else { | 284 | } else { |
282 | if( tag[0] == '(' && tag[1] != '(' ) { | 285 | if( tag[0] == '(' && tag[1] != '(' ) { |
283 | entry->genre_string = id3_get_num_genre(atoi( tag + 1 )); | 286 | entry->genre_string = id3_get_num_genre(atoi( tag + 1 )); |
284 | return tag - entry->id3v2buf; | 287 | return bufferpos; |
285 | } | 288 | } |
286 | else { | 289 | else { |
287 | entry->genre_string = tag; | 290 | entry->genre_string = tag; |
288 | return bufferpos; | 291 | return bufferpos + strlen(tag) + 1; |
289 | } | 292 | } |
290 | } | 293 | } |
291 | } | 294 | } |
@@ -360,7 +363,7 @@ static int parseuser( struct mp3entry* entry, char* tag, int bufferpos ) | |||
360 | /* 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 |
361 | * parse it */ | 364 | * parse it */ |
362 | value = tag + desc_len + 1; | 365 | value = tag + desc_len + 1; |
363 | value_len = bufferpos - (tag - entry->id3v2buf); | 366 | value_len = strlen(value) + 1; |
364 | 367 | ||
365 | if (!strcasecmp(tag, "ALBUM ARTIST")) { | 368 | if (!strcasecmp(tag, "ALBUM ARTIST")) { |
366 | strlcpy(tag, value, value_len); | 369 | strlcpy(tag, value, value_len); |
@@ -368,6 +371,8 @@ static int parseuser( struct mp3entry* entry, char* tag, int bufferpos ) | |||
368 | #if CONFIG_CODEC == SWCODEC | 371 | #if CONFIG_CODEC == SWCODEC |
369 | } else { | 372 | } else { |
370 | value_len = parse_replaygain(tag, value, entry, tag, value_len); | 373 | value_len = parse_replaygain(tag, value, entry, tag, value_len); |
374 | #else | ||
375 | value_len = 0; | ||
371 | #endif | 376 | #endif |
372 | } | 377 | } |
373 | } | 378 | } |
@@ -1038,12 +1043,6 @@ void setid3v2title(int fd, struct mp3entry *entry) | |||
1038 | #endif | 1043 | #endif |
1039 | if( tr->ppFunc ) | 1044 | if( tr->ppFunc ) |
1040 | bufferpos = tr->ppFunc(entry, tag, bufferpos); | 1045 | bufferpos = tr->ppFunc(entry, tag, bufferpos); |
1041 | |||
1042 | /* Trim. Take into account that multiple string contents will | ||
1043 | * only be displayed up to their first null termination. All | ||
1044 | * content after this null termination is obsolete and can be | ||
1045 | * overwritten. */ | ||
1046 | bufferpos -= (bytesread - strlen(tag)); | ||
1047 | 1046 | ||
1048 | /* Seek to the next frame */ | 1047 | /* Seek to the next frame */ |
1049 | if(framelen < totframelen) | 1048 | if(framelen < totframelen) |