diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/metadata/mp3.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/metadata/mp3.c b/apps/metadata/mp3.c index f02700055a..20596b1961 100644 --- a/apps/metadata/mp3.c +++ b/apps/metadata/mp3.c | |||
@@ -89,7 +89,7 @@ static const char* const genres[] = { | |||
89 | 89 | ||
90 | char* id3_get_num_genre(unsigned int genre_num) | 90 | char* id3_get_num_genre(unsigned int genre_num) |
91 | { | 91 | { |
92 | if (genre_num < sizeof(genres)/sizeof(char*)) | 92 | if (genre_num < ARRAYLEN(genres)) |
93 | return (char*)genres[genre_num]; | 93 | return (char*)genres[genre_num]; |
94 | return NULL; | 94 | return NULL; |
95 | } | 95 | } |
@@ -97,8 +97,13 @@ char* id3_get_num_genre(unsigned int genre_num) | |||
97 | /* True if the string is from the "genres" array */ | 97 | /* True if the string is from the "genres" array */ |
98 | bool id3_is_genre_string(const char *string) | 98 | bool id3_is_genre_string(const char *string) |
99 | { | 99 | { |
100 | return ( string >= genres[0] && | 100 | unsigned int i; |
101 | string <= genres[sizeof(genres)/sizeof(char*) - 1] ); | 101 | |
102 | for(i=0; i < ARRAYLEN(genres); i++) | ||
103 | if(genres[i] == string) | ||
104 | return true; | ||
105 | |||
106 | return false; | ||
102 | } | 107 | } |
103 | 108 | ||
104 | /* | 109 | /* |
@@ -445,7 +450,7 @@ static const struct tag_resolver taglist[] = { | |||
445 | { "UFID", 4, 0, &parsembtid, false }, | 450 | { "UFID", 4, 0, &parsembtid, false }, |
446 | }; | 451 | }; |
447 | 452 | ||
448 | #define TAGLIST_SIZE ((int)(sizeof(taglist) / sizeof(taglist[0]))) | 453 | #define TAGLIST_SIZE ((int)ARRAYLEN(taglist)) |
449 | 454 | ||
450 | /* Get the length of an ID3 string in the given encoding. Returns the length | 455 | /* Get the length of an ID3 string in the given encoding. Returns the length |
451 | * in bytes, including end nil, or -1 if the encoding is unknown. | 456 | * in bytes, including end nil, or -1 if the encoding is unknown. |