diff options
Diffstat (limited to 'lib/rbcodec/metadata/asap.c')
-rw-r--r-- | lib/rbcodec/metadata/asap.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/rbcodec/metadata/asap.c b/lib/rbcodec/metadata/asap.c index 47eb2a3d50..db23dd69fa 100644 --- a/lib/rbcodec/metadata/asap.c +++ b/lib/rbcodec/metadata/asap.c | |||
@@ -185,38 +185,41 @@ static bool parse_sap_header(int fd, struct mp3entry* id3, int file_len) | |||
185 | break; | 185 | break; |
186 | } | 186 | } |
187 | } | 187 | } |
188 | 188 | static const char *tg_options[] = {"SAP", "AUTHOR", "NAME", "DATE", | |
189 | "SONGS", "DEFSONG", "TIME", NULL}; | ||
189 | /* parse tags */ | 190 | /* parse tags */ |
190 | if(strcmp(line, "SAP") == 0) | 191 | int tg_op = string_option(line, tg_options, false); |
192 | if (tg_op == 0) /*SAP*/ | ||
191 | sap_signature = 1; | 193 | sap_signature = 1; |
192 | if (sap_signature == -1) | 194 | if (sap_signature == -1) |
193 | return false; | 195 | return false; |
194 | if (strcmp(line, "AUTHOR") == 0) | 196 | |
197 | if (tg_op == 1) /*AUTHOR*/ | ||
195 | { | 198 | { |
196 | if(read_asap_string(p, &buffer, &buffer_end, &id3->artist) == false) | 199 | if(read_asap_string(p, &buffer, &buffer_end, &id3->artist) == false) |
197 | return false; | 200 | return false; |
198 | } | 201 | } |
199 | else if(strcmp(line, "NAME") == 0) | 202 | else if(tg_op == 2) /*NAME*/ |
200 | { | 203 | { |
201 | if(read_asap_string(p, &buffer, &buffer_end, &id3->title) == false) | 204 | if(read_asap_string(p, &buffer, &buffer_end, &id3->title) == false) |
202 | return false; | 205 | return false; |
203 | } | 206 | } |
204 | else if(strcmp(line, "DATE") == 0) | 207 | else if(tg_op == 3) /*DATE*/ |
205 | { | 208 | { |
206 | if(read_asap_string(p, &buffer, &buffer_end, &id3->year_string) == false) | 209 | if(read_asap_string(p, &buffer, &buffer_end, &id3->year_string) == false) |
207 | return false; | 210 | return false; |
208 | } | 211 | } |
209 | else if (strcmp(line, "SONGS") == 0) | 212 | else if (tg_op == 4) /*SONGS*/ |
210 | { | 213 | { |
211 | if (parse_dec(&numSongs, p, 1, MAX_SONGS) == false ) | 214 | if (parse_dec(&numSongs, p, 1, MAX_SONGS) == false ) |
212 | return false; | 215 | return false; |
213 | } | 216 | } |
214 | else if (strcmp(line, "DEFSONG") == 0) | 217 | else if (tg_op == 5) /*DEFSONG*/ |
215 | { | 218 | { |
216 | if (parse_dec(&defSong, p, 0, MAX_SONGS) == false) | 219 | if (parse_dec(&defSong, p, 0, MAX_SONGS) == false) |
217 | return false; | 220 | return false; |
218 | } | 221 | } |
219 | else if (strcmp(line, "TIME") == 0) | 222 | else if (tg_op == 6) /*TIME*/ |
220 | { | 223 | { |
221 | int durationTemp = ASAP_ParseDuration(p); | 224 | int durationTemp = ASAP_ParseDuration(p); |
222 | if (durationTemp < 0 || duration_index >= MAX_SONGS) | 225 | if (durationTemp < 0 || duration_index >= MAX_SONGS) |