fix bug #896057: parsing ISRC number from cuesheet
authorJosh Coalson <jcoalson@users.sourceforce.net>
Mon, 19 Jul 2004 06:36:26 +0000 (06:36 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Mon, 19 Jul 2004 06:36:26 +0000 (06:36 +0000)
src/share/grabbag/cuesheet.c
test/cuesheets/good.001.cue

index d95b74f..5c493f7 100644 (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;
                        }
                        else if(0 == FLAC__STRCASECMP(field, "ISRC")) {
+                               char *l, *r;
                                if(track_has_isrc) {
                                        *error_message = "found multiple ISRC commands";
                                        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";
                                        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) {
                                        *error_message = "invalid ISRC number";
                                        return false;
index f017a70..f9887cf 100644 (file)
@@ -109,7 +109,7 @@ FILE "z.wav" WAVE
     INDEX 98 03:42:58
     INDEX 99 03:42:59
   TRACK 03 AUDIO
-    ISRC ABCD76543210
+    ISRC AB-CD7-65-43210
     INDEX 00 04:50:12
     INDEX 01 04:51:72
   TRACK 04 AUDIO