summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-10-28 14:46:45 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-10-28 14:46:45 +0000
commit895eb984acec716cc6d54f0c77328b4a41c08344 (patch)
treed24eab0b1720ad723762fb8a1e72bb4964ab0a3a /firmware
parent36cd5f1e4b8cc693111edb415b06888fbcf06d1e (diff)
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
Diffstat (limited to 'firmware')
-rw-r--r--firmware/id3.c10
1 files changed, 9 insertions, 1 deletions
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;