[Cl-darcs-cvs] r107 - cl-darcs/trunk

mhenoch at common-lisp.net mhenoch at common-lisp.net
Sun Mar 11 03:10:57 UTC 2007


Author: mhenoch
Date: Sat Mar 10 22:10:57 2007
New Revision: 107

Modified:
   cl-darcs/trunk/util.lisp
Log:
Fix EOF handling of READ-BINARY-LINE


Modified: cl-darcs/trunk/util.lisp
==============================================================================
--- cl-darcs/trunk/util.lisp	(original)
+++ cl-darcs/trunk/util.lisp	Sat Mar 10 22:10:57 2007
@@ -96,10 +96,15 @@
 Return a vector of binary values.  Return EOF-VALUE if EOF-ERROR-P
 is nil and end-of-file occurs before any data is read."
   (multiple-value-bind (line delim)
-      (read-until 10 stream eof-error-p eof-value)
-    (if (or (not (zerop (length line))) (eql delim 10))
-	line
-	delim)))
+      (read-until 10 stream nil :eof)
+    (cond
+      ;; nothing read, and we've reached the end
+      ((and (zerop (length line)) (eq delim :eof))
+       (if eof-error-p
+	   (error 'end-of-file :stream stream)
+	   eof-value))
+      (t
+       line))))
 
 (defun read-token (stream)
   "Read and return a whitespace-separated token from STREAM.



More information about the Cl-darcs-cvs mailing list