1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Maurus Cuelenaere 2009-08-01 19:52:54 +00:00
parent faf37f9d21
commit 1ace06a67d
3 changed files with 2 additions and 14 deletions

View file

@ -458,7 +458,8 @@ void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig)
entry->artist += offset; entry->artist += offset;
if (entry->album) if (entry->album)
entry->album += offset; entry->album += offset;
if (entry->genre_string && !id3_is_genre_string(entry->genre_string)) if (entry->genre_string > (char*)orig
&& entry->genre_string < (char*)orig + sizeof(struct mp3entry))
/* Don't adjust that if it points to an entry of the "genres" array */ /* Don't adjust that if it points to an entry of the "genres" array */
entry->genre_string += offset; entry->genre_string += offset;
if (entry->track_string) if (entry->track_string)

View file

@ -20,7 +20,6 @@
****************************************************************************/ ****************************************************************************/
char* id3_get_num_genre(unsigned int genre_num); char* id3_get_num_genre(unsigned int genre_num);
bool id3_is_genre_string(const char *string);
int getid3v2len(int fd); int getid3v2len(int fd);
bool get_mp3_metadata(int fd, struct mp3entry* id3, const char *filename); bool get_mp3_metadata(int fd, struct mp3entry* id3, const char *filename);

View file

@ -94,18 +94,6 @@ char* id3_get_num_genre(unsigned int genre_num)
return NULL; return NULL;
} }
/* True if the string is from the "genres" array */
bool id3_is_genre_string(const char *string)
{
unsigned int i;
for(i=0; i < ARRAYLEN(genres); i++)
if(genres[i] == string)
return true;
return false;
}
/* /*
HOW TO ADD ADDITIONAL ID3 VERSION 2 TAGS HOW TO ADD ADDITIONAL ID3 VERSION 2 TAGS
Code and comments by Thomas Paul Diffenbach Code and comments by Thomas Paul Diffenbach