summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-08-01 19:52:54 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-08-01 19:52:54 +0000
commit1ace06a67d5ec4df3a0295a341124677782baf70 (patch)
tree9ba4ff6fffe72cacda37e4c9e977b1b23f68084c /apps
parentfaf37f9d216c76db1ff8e1ba5aca6c69365bc9c6 (diff)
downloadrockbox-1ace06a67d5ec4df3a0295a341124677782baf70.tar.gz
rockbox-1ace06a67d5ec4df3a0295a341124677782baf70.zip
Metadata parser: make adjust_mp3entry() not depend on id3_is_genre_string(), so there's no need to compare the string to the whole genre array (thanks to Mikael Magnusson)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22105 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/metadata.c3
-rw-r--r--apps/metadata/metadata_parsers.h1
-rw-r--r--apps/metadata/mp3.c12
3 files changed, 2 insertions, 14 deletions
diff --git a/apps/metadata.c b/apps/metadata.c
index b3a4deb385..f227776c0a 100644
--- a/apps/metadata.c
+++ b/apps/metadata.c
@@ -458,7 +458,8 @@ void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig)
458 entry->artist += offset; 458 entry->artist += offset;
459 if (entry->album) 459 if (entry->album)
460 entry->album += offset; 460 entry->album += offset;
461 if (entry->genre_string && !id3_is_genre_string(entry->genre_string)) 461 if (entry->genre_string > (char*)orig
462 && entry->genre_string < (char*)orig + sizeof(struct mp3entry))
462 /* Don't adjust that if it points to an entry of the "genres" array */ 463 /* Don't adjust that if it points to an entry of the "genres" array */
463 entry->genre_string += offset; 464 entry->genre_string += offset;
464 if (entry->track_string) 465 if (entry->track_string)
diff --git a/apps/metadata/metadata_parsers.h b/apps/metadata/metadata_parsers.h
index 760d9a0da3..0464071777 100644
--- a/apps/metadata/metadata_parsers.h
+++ b/apps/metadata/metadata_parsers.h
@@ -20,7 +20,6 @@
20 ****************************************************************************/ 20 ****************************************************************************/
21 21
22char* id3_get_num_genre(unsigned int genre_num); 22char* id3_get_num_genre(unsigned int genre_num);
23bool id3_is_genre_string(const char *string);
24int getid3v2len(int fd); 23int getid3v2len(int fd);
25bool get_mp3_metadata(int fd, struct mp3entry* id3, const char *filename); 24bool get_mp3_metadata(int fd, struct mp3entry* id3, const char *filename);
26 25
diff --git a/apps/metadata/mp3.c b/apps/metadata/mp3.c
index 20596b1961..21cdeff3fc 100644
--- a/apps/metadata/mp3.c
+++ b/apps/metadata/mp3.c
@@ -94,18 +94,6 @@ char* id3_get_num_genre(unsigned int genre_num)
94 return NULL; 94 return NULL;
95} 95}
96 96
97/* True if the string is from the "genres" array */
98bool id3_is_genre_string(const char *string)
99{
100 unsigned int i;
101
102 for(i=0; i < ARRAYLEN(genres); i++)
103 if(genres[i] == string)
104 return true;
105
106 return false;
107}
108
109/* 97/*
110 HOW TO ADD ADDITIONAL ID3 VERSION 2 TAGS 98 HOW TO ADD ADDITIONAL ID3 VERSION 2 TAGS
111 Code and comments by Thomas Paul Diffenbach 99 Code and comments by Thomas Paul Diffenbach