From c36b473ee1eba3a2f08ecc45959deba1660701c1 Mon Sep 17 00:00:00 2001 From: Eric Timmons <etimmons@mit.edu> Date: Mon, 3 Jan 2022 12:42:45 -0500 Subject: [PATCH] Remove check on STREAM-ELEMENT-TYPE --- CHANGELOG.md | 6 ++++++ src/blocked-stream.lisp | 16 ++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 399e8c7..7a813b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## Unreleased + ++ Remove check on stream element type. On at least SBCL and ECL, + `*standard-input*` and `*standard-output*` have element type `'character`, + but also allow you to use binary stream functions on them. + ## v0.1.3 - January 02, 2022 + Fix bug with determining type of entries in v7 archives. diff --git a/src/blocked-stream.lisp b/src/blocked-stream.lisp index 91113d6..ae87862 100644 --- a/src/blocked-stream.lisp +++ b/src/blocked-stream.lisp @@ -83,16 +83,12 @@ of the wrapped stream when instantiated.")) (defmethod initialize-instance :after ((blocked-stream blocked-stream) &key stream) - (let ((element-type (or (ignore-errors (stream-element-type stream)) - '(unsigned-byte 8)))) - (assert (subtypep element-type 'integer) - nil "STREAM must be a binary stream") - ;; Create the buffer. - (setf (buffer blocked-stream) (make-array (block-size blocked-stream) - :element-type element-type - :initial-element 0) - ;; Record the START-FILE-POSITION - (start-file-position blocked-stream) (ignore-errors (file-position stream))))) + ;; Create the buffer. + (setf (buffer blocked-stream) (make-array (block-size blocked-stream) + :element-type '(unsigned-byte 8) + :initial-element 0) + ;; Record the START-FILE-POSITION + (start-file-position blocked-stream) (ignore-errors (file-position stream)))) (defgeneric discard-buffer (stream) (:documentation -- GitLab