fix bug #896057: parsing ISRC number from cuesheet

This commit is contained in:
Josh Coalson
2004-07-19 06:36:26 +00:00
parent 12d7fcb8d9
commit a175043b3f
2 changed files with 8 additions and 1 deletions

View File

@@ -334,6 +334,7 @@ static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message,
track->indices[track->num_indices-1].number = in_index_num; track->indices[track->num_indices-1].number = in_index_num;
} }
else if(0 == FLAC__STRCASECMP(field, "ISRC")) { else if(0 == FLAC__STRCASECMP(field, "ISRC")) {
char *l, *r;
if(track_has_isrc) { if(track_has_isrc) {
*error_message = "found multiple ISRC commands"; *error_message = "found multiple ISRC commands";
return false; return false;
@@ -346,6 +347,12 @@ static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message,
*error_message = "ISRC is missing ISRC number"; *error_message = "ISRC is missing ISRC number";
return false; return false;
} }
/* strip out dashes */
for(l = r = field; *r; r++) {
if(*r != '-')
*l++ = *r;
}
*l = '\0';
if(strlen(field) != 12 || strspn(field, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") < 5 || strspn(field+5, "1234567890") != 7) { if(strlen(field) != 12 || strspn(field, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") < 5 || strspn(field+5, "1234567890") != 7) {
*error_message = "invalid ISRC number"; *error_message = "invalid ISRC number";
return false; return false;

View File

@@ -109,7 +109,7 @@ FILE "z.wav" WAVE
INDEX 98 03:42:58 INDEX 98 03:42:58
INDEX 99 03:42:59 INDEX 99 03:42:59
TRACK 03 AUDIO TRACK 03 AUDIO
ISRC ABCD76543210 ISRC AB-CD7-65-43210
INDEX 00 04:50:12 INDEX 00 04:50:12
INDEX 01 04:51:72 INDEX 01 04:51:72
TRACK 04 AUDIO TRACK 04 AUDIO