master: More type checks for the stream functions

stassats via Sbcl-commits <[email protected]>
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  16880629988bd393a216f9e781030e0330020959 (commit)
      from  04d757a9988b75bb44f649ca80186eadb3d7728d (commit)

- Log -----------------------------------------------------------------
commit 16880629988bd393a216f9e781030e0330020959
Author: Stas Boukarev <[email protected]>
Date:   Sat Apr 11 00:13:02 2026 +0300

    More type checks for the stream functions
---
 src/code/stream.lisp        |  8 ++++----
 src/code/target-stream.lisp | 26 +++++++++++++-------------
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/src/code/stream.lisp b/src/code/stream.lisp
index c4f59fefe..df586190e 100644
--- a/src/code/stream.lisp
+++ b/src/code/stream.lisp
@@ -679,7 +679,7 @@
   (stream-api-dispatch (stream :output)
     :native (return-from write-char (funcall (ansi-stream-cout stream) stream character))
     :simple (s-%write-char stream character)
-    :gray (stream-write-char stream character))
+    :gray (stream-write-char stream (the character character)))
   character)
 
 (defun terpri (&optional (stream *standard-output*))
@@ -714,7 +714,7 @@
                              ,@(when (eq name '%write-line)
                                  '((funcall (ansi-stream-cout stream) stream #\newline))))
               :simple (,(symbolicate "S-" name) stream data start end)
-              :gray (progn (stream-write-string stream data start end)
+              :gray (progn (stream-write-string stream (the string data) start end)
                            ,@(when (eq name '%write-line)
                                '((stream-write-char stream #\newline))))))
           string)))
@@ -773,7 +773,7 @@
   (stream-api-dispatch (stream)
     :native (return-from write-byte (funcall (ansi-stream-bout stream) stream integer))
     :simple (s-%write-byte stream integer)
-    :gray (stream-write-byte stream integer))
+    :gray (stream-write-byte stream (the integer integer)))
   integer)
 
 
@@ -1599,7 +1599,7 @@ benefit of the function GET-OUTPUT-STREAM-STRING."
            nil))))
 
 (defun string-sout (stream string start end)
-  (declare (explicit-check string)
+  (declare (string string)
            (type index start end))
   ;; FIXME: this contains about 7 OBJECT-NOT-INDEX error traps.
   ;; We should be able to check once up front that the string-stream will not
diff --git a/src/code/target-stream.lisp b/src/code/target-stream.lisp
index 50c7834e0..5b486e57b 100644
--- a/src/code/target-stream.lisp
+++ b/src/code/target-stream.lisp
@@ -159,7 +159,7 @@
                             (eof-error-p t)
                             eof-value
                             recursive-p)
-  (declare (type (or character boolean) peek-type) (explicit-check))
+  (declare (explicit-check stream))
   (stream-api-dispatch (stream :input)
     :simple (let ((char (s-%peek-char stream peek-type eof-error-p eof-value)))
               ;; simple-streams -%PEEK-CHAR always ignored RECURSIVE-P
@@ -169,18 +169,18 @@
         (ansi-stream-peek-char peek-type stream eof-error-p eof-value
                                recursive-p)
     :gray
-        (let ((char
-               (generalized-peeking-mechanism
-                peek-type :eof char
-                (if (null peek-type)
-                    (stream-peek-char stream)
-                    (stream-read-char stream))
-                :eof
-                (if (null peek-type)
-                    ()
-                    (stream-unread-char stream char))
-                ()
-                (eof-or-lose stream eof-error-p eof-value))))
+        (let* ((char
+                 (generalized-peeking-mechanism
+                     peek-type :eof char
+                     (if (null peek-type)
+                         (stream-peek-char stream)
+                         (stream-read-char stream))
+                     :eof
+                     (if (null peek-type)
+                         ()
+                         (stream-unread-char stream char))
+                     ()
+                     (eof-or-lose stream eof-error-p eof-value))))
           (if (eq char eof-value)
               char
               (the character char)))))

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.