From e83c804fc22db666870d05dd38b9b5bd37a2558f Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Wed, 9 Dec 2020 22:38:09 +0300 Subject: [PATCH] Try read-sequence again. --- input.lisp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/input.lisp b/input.lisp index bed1b13..0843347 100644 --- a/input.lisp +++ b/input.lisp @@ -142,10 +142,15 @@ extensions) and returns the size." ((> chunk-size (length input-buffer)) ;; replace buffer if it isn't big enough for the next chunk (setq input-buffer (make-array chunk-size :element-type '(unsigned-byte 8))))) - (unless (= (read-sequence input-buffer inner-stream :start 0 :end chunk-size) - chunk-size) - (error 'input-chunking-unexpected-end-of-file - :stream stream)) + (loop with start = 0 + with end = chunk-size + for read = (read-sequence input-buffer inner-stream :start start :end end) + while (< read end) + do + (when (= read start) + (error 'input-chunking-unexpected-end-of-file + :stream stream)) + (setf start read)) chunk-size))))) (defmethod stream-read-byte ((stream chunked-input-stream))