X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=contrib%2Fsb-simple-streams%2Finternal.lisp;h=a74aabb2951f2e75b5d3b656bbf3788e20ad52bb;hb=905a0fc4c21ff6c8c752b9436e0616b868f1dfcc;hp=1df77e95cab7dc7198cf32efe2f30f075ffbb926;hpb=3189006493c5d7389dde68eff83f713074946d5e;p=sbcl.git diff --git a/contrib/sb-simple-streams/internal.lisp b/contrib/sb-simple-streams/internal.lisp index 1df77e9..a74aabb 100644 --- a/contrib/sb-simple-streams/internal.lisp +++ b/contrib/sb-simple-streams/internal.lisp @@ -28,8 +28,8 @@ (declare (type simple-stream-buffer buffer) (type (integer 0 #.most-positive-fixnum) index)) (if (vectorp buffer) - (sb-sys:sap-ref-8 (sb-sys:vector-sap buffer) index)) - (sb-sys:sap-ref-8 buffer index)) + (sb-sys:sap-ref-8 (sb-sys:vector-sap buffer) index) + (sb-sys:sap-ref-8 buffer index))) (defun (setf bref) (octet buffer index) (declare (type (unsigned-byte 8) octet) @@ -43,9 +43,9 @@ (declare (type simple-stream-buffer src dst) (type fixnum soff doff length)) (sb-sys:without-gcing ;; is this necessary?? - (sb-kernel:system-area-copy (buffer-sap src) (* soff 8) - (buffer-sap dst) (* doff 8) - (* length 8)))) + (sb-kernel:system-area-ub8-copy (buffer-sap src) soff + (buffer-sap dst) doff + length))) (defun allocate-buffer (size) (if (= size sb-impl::bytes-per-buffer) @@ -83,7 +83,13 @@ (defun std-dc-newline-in-handler (stream character) (with-stream-class (dual-channel-simple-stream stream) - (setf (sm charpos stream) -1) ;; set to 0 "if reading" ??? + ;; FIXME: Currently, -1 is wrong, since callers of CHARPOS expect + ;; a result in (or null (and fixnum unsigned-byte)), so they must + ;; never see this temporary value. Note that in + ;; STD-NEWLINE-OUT-HANDLER it is correct to use -1, since CHARPOS + ;; is incremented to zero before WRITE-CHAR returns. Perhaps the + ;; same should happen for input? + (setf (sm charpos stream) 0) ; was -1 character)) (defvar *std-control-out-table* @@ -467,6 +473,8 @@ (declare (type sb-int:index mask)) (let ((name (cond ((sb-int:unix-namestring pathname input)) ((and input (eq if-does-not-exist :create)) + (sb-int:unix-namestring pathname nil)) + ((and (eq direction :io) (not if-does-not-exist-given)) (sb-int:unix-namestring pathname nil))))) ;; Process if-exists argument if we are doing any output. (cond (output @@ -476,11 +484,11 @@ :new-version :error))) (case if-exists - ((:error nil) + ((:error nil :new-version) (setf mask (logior mask sb-unix:o_excl))) ((:rename :rename-and-delete) (setf mask (logior mask sb-unix:o_creat))) - ((:new-version :supersede) + ((:supersede) (setf mask (logior mask sb-unix:o_trunc))))) (t (setf if-exists nil))) ; :ignore-this-arg