From 81203d07b601668de562b3db9c5c7d1e273a4fff Mon Sep 17 00:00:00 2001
From: toy <toy>
Date: Fri, 2 Aug 2002 14:43:08 +0000
Subject: [PATCH] Only create a buffer for streams of type (unsigned-byte 8). 
 Fixes the bug where read-byte from (signed-byte 8) (or less) streams would
 produce unsigned instead of signed numbers.

---
 code/fd-stream.lisp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/code/fd-stream.lisp b/code/fd-stream.lisp
index 706927f72..415170504 100644
--- a/code/fd-stream.lisp
+++ b/code/fd-stream.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream.lisp,v 1.59 2002/04/03 18:30:40 pw Exp $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream.lisp,v 1.60 2002/08/02 14:43:08 toy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -857,7 +857,13 @@
 		  (eql size 4))
 	  ;; Support for n-byte operations on 8-, 16-, and 32-bit streams
 	  (setf (fd-stream-n-bin stream) #'fd-stream-read-n-bytes)
-	  (when (and buffer-p (eql size 1))
+	  (when (and buffer-p (eql size 1)
+		     (or (eq type 'unsigned-byte)
+			 (eq type :default)))
+	    ;; We only create this buffer for streams of type
+	    ;; (unsigned-byte 8).  Because there's no buffer, the
+	    ;; other element-types will dispatch to the appropriate
+	    ;; input (output) routine in fast-read-byte.
 	    (setf (lisp-stream-in-buffer stream)
 		  (make-array in-buffer-length
 			      :element-type '(unsigned-byte 8)))))
-- 
GitLab