fix bug in cuesheet parsing where it would return an error if the last line of the...
authorJosh Coalson <jcoalson@users.sourceforce.net>
Tue, 9 Aug 2005 00:59:39 +0000 (00:59 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Tue, 9 Aug 2005 00:59:39 +0000 (00:59 +0000)
doc/html/changelog.html
src/share/grabbag/cuesheet.c
test/cuesheet.ok
test/cuesheets/good.002.dos_format.cue [new file with mode: 0644]
test/cuesheets/good.003.missing_final_newline.cue [new file with mode: 0644]
test/cuesheets/good.004.dos_format.missing_final_newline.cue [new file with mode: 0644]

index 2b379a1..ab085b9 100644 (file)
 
                <br /><br />
 
+               <a name="flac_1_1_3"><b>FLAC 1.1.3</b></a>
+
+               <br />
+
+               <ul>
+                       <li>
+                               General:
+                               <ul>
+                                       <li>(none)</li>
+                               </ul>
+                       </li>
+                       <li>
+                               FLAC format:
+                               <ul>
+                                       <li>(none)</li>
+                               </ul>
+                       </li>
+                       <li>
+                               Ogg FLAC format:
+                               <ul>
+                                       <li>(none)</li>
+                               </ul>
+                       </li>
+                       <li>
+                               flac:
+                               <ul>
+                                       <li>Fixed a bug in cuesheet parsing where it would return an error if the last line of the cuesheet did not end with a newline.</li>
+                               </ul>
+                       </li>
+                       <li>
+                               metaflac:
+                               <ul>
+                                       <li>(none)</li>
+                               </ul>
+                       </li>
+                       <li>
+                               plugins:
+                               <ul>
+                                       <li>(none)</li>
+                               </ul>
+                       </li>
+                       <li>
+                               build system:
+                               <ul>
+                                       <li>(none)</li>
+                               </ul>
+                       </li>
+                       <li>
+                               libraries:
+                               <ul>
+                                       <li>libFLAC: Fixed a bug in cuesheet parsing where it would return an error if the last line of the cuesheet did not end with a newline.</li>
+                               </ul>
+                       </li>
+                       <li>
+                               Interface changes:
+                               <ul>
+                                       <li>
+                                               libFLAC:
+                                               <ul>
+                                                       <li>(none)</li>
+                                               </ul>
+                                       </li>
+                                       <li>
+                                               libFLAC++:
+                                               <ul>
+                                                       <li>(none)</li>
+                                               </ul>
+                                       </li>
+                                       <li>
+                                               libOggFLAC:
+                                               <ul>
+                                                       <li>(none)</li>
+                                               </ul>
+                                       </li>
+                                       <li>
+                                               libOggFLAC++:
+                                               <ul>
+                                                       <li>(none)</li>
+                                               </ul>
+                                       </li>
+                               </ul>
+                       </li>
+               </ul>
+
+               <br />
+
                <a name="flac_1_1_2"><b>FLAC 1.1.2</b></a>
 
                <br />
index 58fa444..e8b53ca 100644 (file)
@@ -202,7 +202,7 @@ static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message,
 #define FLAC__STRCASECMP strcasecmp
 #endif
        char buffer[4096], *line, *field;
-       unsigned linelen, forced_leadout_track_num = 0;
+       unsigned forced_leadout_track_num = 0;
        FLAC__uint64 forced_leadout_track_offset = 0;
        int in_track_num = -1, in_index_num = -1;
        FLAC__bool disc_has_catalog = false, track_has_flags = false, track_has_isrc = false, has_forced_leadout = false;
@@ -215,10 +215,12 @@ static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message,
                (*last_line_read)++;
                line = buffer;
 
-               linelen = strlen(line);
-               if(line[linelen-1] != '\n') {
-                       *error_message = "line too long";
-                       return false;
+               {
+                       size_t linelen = strlen(line);
+                       if((linelen == sizeof(buffer)-1) && line[linelen-1] != '\n') {
+                               *error_message = "line too long";
+                               return false;
+                       }
                }
 
                if(0 != (field = local__get_field_(&line, /*allow_quotes=*/false))) {
index 19096d1..c57f833 100644 (file)
@@ -88,3 +88,6 @@ NEGATIVE cuesheets/bad.235.FLAC_leadout_offset_not_211680000.cue
 pass1: parse error, line 1: "FLAC__lead-out offset does not match end-of-stream offset"
 POSITIVE cuesheets/good.000.cue
 POSITIVE cuesheets/good.001.cue
+POSITIVE cuesheets/good.002.dos_format.cue
+POSITIVE cuesheets/good.003.missing_final_newline.cue
+POSITIVE cuesheets/good.004.dos_format.missing_final_newline.cue
diff --git a/test/cuesheets/good.002.dos_format.cue b/test/cuesheets/good.002.dos_format.cue
new file mode 100644 (file)
index 0000000..a60e03b
--- /dev/null
@@ -0,0 +1,4 @@
+CATALOG "1234567890123"\r
+FILE "z.wav" WAVE\r
+  TRACK 01 AUDIO\r
+    INDEX 01 00:00:00\r
diff --git a/test/cuesheets/good.003.missing_final_newline.cue b/test/cuesheets/good.003.missing_final_newline.cue
new file mode 100644 (file)
index 0000000..a4c298f
--- /dev/null
@@ -0,0 +1,4 @@
+CATALOG "1234567890123"
+FILE "z.wav" WAVE
+  TRACK 01 AUDIO
+    INDEX 01 00:00:00
\ No newline at end of file
diff --git a/test/cuesheets/good.004.dos_format.missing_final_newline.cue b/test/cuesheets/good.004.dos_format.missing_final_newline.cue
new file mode 100644 (file)
index 0000000..1f6d0e5
--- /dev/null
@@ -0,0 +1,4 @@
+CATALOG "1234567890123"\r
+FILE "z.wav" WAVE\r
+  TRACK 01 AUDIO\r
+    INDEX 01 00:00:00
\ No newline at end of file