Commit 6ff6820c authored by Tim Bradshaw's avatar Tim Bradshaw
Browse files

read-stream-content-into string: buffer elt type

The element type of the buffer should also be the element type of the
stream, rather than character.

This is a fix to the previous commit.
parent 9c97e6f6
......@@ -53,10 +53,10 @@ which is only sent to WITH-OPEN-FILE when it's not NIL."
(defun read-stream-content-into-string (stream &key (buffer-size 4096))
"Return the \"content\" of STREAM as a fresh string."
(check-type buffer-size positive-integer)
(let ((*print-pretty* nil))
(with-output-to-string (datum nil
:element-type (stream-element-type stream))
(let ((buffer (make-array buffer-size :element-type 'character)))
(let ((*print-pretty* nil)
(element-type (stream-element-type stream)))
(with-output-to-string (datum nil :element-type element-type)
(let ((buffer (make-array buffer-size :element-type element-type)))
:for bytes-read = (read-sequence buffer stream)
:do (write-sequence buffer datum :start 0 :end bytes-read)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment