From 7f2058c9cb6ed81df0e2e22863797f9c0a3196e5 Mon Sep 17 00:00:00 2001
From: Raymond Toy <toy.raymond@gmail.com>
Date: Tue, 24 Apr 2012 22:05:35 -0700
Subject: [PATCH] Correct the type declarations for the state (for BOM).

---
 src/pcl/simple-streams/external-formats/utf-16.lisp | 2 +-
 src/pcl/simple-streams/external-formats/utf-32.lisp | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/pcl/simple-streams/external-formats/utf-16.lisp b/src/pcl/simple-streams/external-formats/utf-16.lisp
index d197aeadb..c8ad61a74 100644
--- a/src/pcl/simple-streams/external-formats/utf-16.lisp
+++ b/src/pcl/simple-streams/external-formats/utf-16.lisp
@@ -52,7 +52,7 @@ Unicode replacement character.")
 			    ;; Big endian (including BOM, if any)
 			    (+ (* 256 ,c1) ,c2)))
 		 (,wd 2))
-	    (declare (type (integer 0 2) ,st)
+	    (declare (type (member 0 -2 2) ,st)
 		     (type lisp:codepoint ,code))
 	    ;; Note that if BOM is read, WD will be 2 but 4 octets have
 	    ;; actually been read: this is intentional - the returned
diff --git a/src/pcl/simple-streams/external-formats/utf-32.lisp b/src/pcl/simple-streams/external-formats/utf-32.lisp
index c0fa8200a..2520f4b46 100644
--- a/src/pcl/simple-streams/external-formats/utf-32.lisp
+++ b/src/pcl/simple-streams/external-formats/utf-32.lisp
@@ -62,8 +62,9 @@ Unicode replacement character.")
 			       (ash ,c3  8)
 			       ,c4)))
 		 (,wd 4))
-	    (declare (type (integer 0 2) ,st)
+	    (declare (type (member 0 -4 4) ,st)
 		     (type (unsigned-byte 8) ,c1 ,c2 ,c3 ,c4)
+		     (type (unsigned-byte 32) ,code)
 		     (optimize (speed 3)))
 	    (cond ((or (>= ,code lisp:codepoint-limit)
 		       (lisp::surrogatep ,code))
-- 
GitLab