From 895eb984acec716cc6d54f0c77328b4a41c08344 Mon Sep 17 00:00:00 2001 From: Nicolas Pennequin Date: Sun, 28 Oct 2007 14:46:45 +0000 Subject: Some genre strings must not be adjusted by adjust_mp3_entry. Thanks to PaulJam for the report. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15346 a1c6a512-1295-4272-9138-f99709370657 --- firmware/id3.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/firmware/id3.c b/firmware/id3.c index a3d6297c14..55d6608a75 100644 --- a/firmware/id3.c +++ b/firmware/id3.c @@ -192,6 +192,13 @@ char* id3_get_num_genre(const unsigned int genre_num) return NULL; } +/* True if the string is from the "genres" array */ +bool id3_is_genre_string(const char *string) +{ + return ( string >= genres[0] && + string <= genres[sizeof(genres)/sizeof(char*) - 1] ); +} + char* id3_get_codec(const struct mp3entry* id3) { if (id3->codectype < AFMT_NUM_CODECS) { @@ -1233,7 +1240,8 @@ void adjust_mp3entry(struct mp3entry *entry, void *dest, void *orig) entry->artist += offset; if (entry->album) entry->album += offset; - if (entry->genre_string) + if (entry->genre_string && !id3_is_genre_string(entry->genre_string)) + /* Don't adjust that if it points to an entry of the "genres" array */ entry->genre_string += offset; if (entry->track_string) entry->track_string += offset; -- cgit