Commit 9c97e6f6 authored by Tim Bradshaw's avatar Tim Bradshaw
Browse files

read-stream-content-into-string element-type fix

Default the element type of the string being created from the element
type of the stream being read.

This has two advantages: it will make things work for implementations
which have a mode where the default string element type is a subtype
of character, and it will also mean that if the stream's element type
is a subtype of character you may get thinner strings.
parent 49e82add
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -54,7 +54,8 @@ which is only sent to WITH-OPEN-FILE when it's not NIL."
  "Return the \"content\" of STREAM as a fresh string."
  (check-type buffer-size positive-integer)
  (let ((*print-pretty* nil))
    (with-output-to-string (datum)
    (with-output-to-string (datum nil
                                  :element-type (stream-element-type stream))
      (let ((buffer (make-array buffer-size :element-type 'character)))
        (loop
          :for bytes-read = (read-sequence buffer stream)