rename SB-SIMPLE-STREAMS utility function
[sbcl.git] / contrib / sb-simple-streams / impl.lisp
index d3e3293..1367ae3 100644 (file)
   (if (typep stream 'file-simple-stream)
       (with-stream-class (file-simple-stream stream)
         (setf (sm pathname stream) new-name)
-        (setf (sm filename stream) (sb-int:unix-namestring new-name nil))
+        (setf (sm filename stream) (%file-namestring new-name))
         t)
       nil))
 
                     (index (or start 0) (1+ index))
                     (end (or end (* (length vector) (vector-elt-width vector))))
                     (endian-swap (endian-swap-value vector endian-swap))
-                    (byte (read-byte-internal encap nil nil t)
-                          (read-byte-internal encap nil nil nil)))
-                   ((or (null byte) (>= index end)) index)
-                (setf (bref vector (logxor index endian-swap)) byte))))))
+                    (flag t nil))
+                   ((>= index end) index)
+                (let ((byte (read-byte-internal encap nil nil flag)))
+                  (unless byte
+                    (return index))
+                  (setf (bref vector (logxor index endian-swap)) byte)))))))
     ((or ansi-stream fundamental-stream)
      (unless (typep vector '(or string
                              (simple-array (signed-byte 8) (*))
            (remf options :input-handle)
            (remf options :output-handle)
            (make-instance class :lisp-stream
-                          (apply #'open-fd-stream filespec options))))))
+                          (apply #'open-fd-stream filespec options)))
+          (t (error "Don't know how to handle the stream class ~A"
+                    (etypecase class
+                      (symbol (find-class class t))
+                      (class class)))))))
 
 
 (declaim (inline read-byte read-char read-char-no-hang unread-char))
@@ -1097,7 +1103,7 @@ is supported only on simple-streams."
      (cond (new-name
             (setf (sb-impl::fd-stream-pathname stream) new-name)
             (setf (sb-impl::fd-stream-file stream)
-                  (sb-int:unix-namestring new-name nil))
+                  (%file-namestring new-name))
             t)
            (t
             (sb-impl::fd-stream-pathname stream))))))