[xiph-commits] r12201 - trunk/vorbis-tools/ogg123

conrad at svn.xiph.org conrad at svn.xiph.org
Sun Dec 10 06:32:35 PST 2006


Author: conrad
Date: 2006-12-10 06:32:29 -0800 (Sun, 10 Dec 2006)
New Revision: 12201

Modified:
   trunk/vorbis-tools/ogg123/playlist.c
Log:
ogg123: Handle CRLF line endings in playlists. Closes ticket:446


Modified: trunk/vorbis-tools/ogg123/playlist.c
===================================================================
--- trunk/vorbis-tools/ogg123/playlist.c	2006-12-10 13:08:10 UTC (rev 12200)
+++ trunk/vorbis-tools/ogg123/playlist.c	2006-12-10 14:32:29 UTC (rev 12201)
@@ -207,8 +207,11 @@
     if (i == length)
       continue;
 
-    /* Crop off last \n if present */
-    if (filename[length - 1] == '\n')
+    /* Crop off trailing newlines if present. Handle DOS (\r\n), Unix (\n)
+     * and MacOS<9 (\r) line endings. */
+    if (filename[length - 2] == '\r' && filename[length - 1] == '\n')
+      filename[length - 2] = '\0';
+    else if (filename[length - 1] == '\n' || filename[length - 1] == '\r')
       filename[length - 1] = '\0';
 
     if (stat(filename, &stat_buf) == 0) {



More information about the commits mailing list