Skip to content

Commit

Permalink
Try read-sequence again.
Browse files Browse the repository at this point in the history
  • Loading branch information
stassats committed Dec 9, 2020
1 parent cb333cd commit e83c804
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions input.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit e83c804

Please sign in to comment.