Update of /cvsroot/sbcl/sbcl/src/code
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv12263/src/code
126.96.36.199: Gray streams as part of composite streams
* READ-N-BYTES needs to deal with Gray streams.
RCS file: /cvsroot/sbcl/sbcl/src/code/stream.lisp,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- stream.lisp 29 Nov 2007 17:30:19 -0000 1.95
+++ stream.lisp 5 Dec 2007 17:23:26 -0000 1.96
@@ -424,7 +424,17 @@
;;; some cases, but it wasn't being used in SBCL, so it was dropped.
;;; If we ever need it, it could be added later as a new variant N-BIN
;;; method (perhaps N-BIN-ASAP?) or something.
+#!-sb-fluid (declaim (inline read-n-bytes))
(defun read-n-bytes (stream buffer start numbytes &optional (eof-error-p t))
+ (if (ansi-stream-p stream)
+ (ansi-stream-read-n-bytes stream buffer start numbytes eof-error-p)
+ ;; We don't need to worry about element-type size here is that
+ ;; callers are supposed to have checked everything is kosher.
+ (let* ((end (+ start numbytes))
+ (read-end (stream-read-sequence stream buffer start end)))
+ (eof-or-lose stream (and eof-error-p (< read-end end)) (- read-end start)))))
+(defun ansi-stream-read-n-bytes (stream buffer start numbytes eof-error-p)
(declare (type ansi-stream stream)
(type index numbytes start)
(type (or (simple-array * (*)) system-area-pointer) buffer))