[Openmcl-cvs-notifications] r11059 - /trunk/source/level-1/l1-sysio.lisp
gb at clozure.com
gb at clozure.com
Sun Oct 12 04:07:56 EDT 2008
Author: gb
Date: Sun Oct 12 04:07:56 2008
New Revision: 11059
Log:
In the FILE-IOBLOCK defstruct: don't claim that OCTET-POS and FILEEOF
slots are of :type fixnum.
In STREAM-LENGTH methods on FILE-STREAM, return NIL if the ioblock
function returns a negative value (which generally means "we got
an error trying to determine the length of the file.")
Modified:
trunk/source/level-1/l1-sysio.lisp
Modified: trunk/source/level-1/l1-sysio.lisp
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/source/level-1/l1-sysio.lisp (original)
+++ trunk/source/level-1/l1-sysio.lisp Sun Oct 12 04:07:56 2008
@@ -17,8 +17,8 @@
(in-package "CCL")
=
(defstruct (file-ioblock (:include ioblock))
- (octet-pos 0 :type fixnum) ; current io position in octets
- (fileeof 0 :type fixnum) ; file length in elements
+ (octet-pos 0 ) ; current io position in octets
+ (fileeof 0 ) ; file length in elements
)
=
=
@@ -588,32 +588,39 @@
=
(defmethod stream-length ((stream fundamental-file-input-stream) &optional=
newlen)
(with-stream-ioblock-input (file-ioblock stream :speedy t)
- (%ioblock-input-file-length file-ioblock newlen)))
+ (let* ((res (%ioblock-input-file-length file-ioblock newlen)))
+ (and res (>=3D res 0) res))))
+
=
(defmethod stream-length ((stream basic-file-input-stream) &optional newle=
n)
(let* ((file-ioblock (basic-stream-ioblock stream)))
(with-ioblock-input-locked (file-ioblock)
- (%ioblock-input-file-length file-ioblock newlen))))
+ (let* ((res (%ioblock-input-file-length file-ioblock newlen)))
+ (and res (>=3D res 0) res)))))
=
=
(defmethod stream-length ((s fundamental-file-output-stream) &optional new=
len)
(with-stream-ioblock-output (file-ioblock s :speedy t)
- (%ioblock-output-file-length file-ioblock newlen)))
+ (let* ((res (%ioblock-output-file-length file-ioblock newlen)))
+ (and res (>=3D res 0) res))))
=
=
(defmethod stream-length ((stream basic-file-output-stream) &optional newl=
en)
(let* ((file-ioblock (basic-stream-ioblock stream)))
(with-ioblock-output-locked (file-ioblock)
- (%ioblock-output-file-length file-ioblock newlen))))
+ (let* ((res (%ioblock-output-file-length file-ioblock newlen)))
+ (and res (>=3D res 0) res)))))
=
(defmethod stream-length ((s fundamental-file-io-stream) &optional newlen)
(with-stream-ioblock-input (file-ioblock s :speedy t)
- (%ioblock-output-file-length file-ioblock newlen)))
+ (let* ((res (%ioblock-output-file-length file-ioblock newlen)))
+ (and res (>=3D res 0) res))))
=
(defmethod stream-length ((stream basic-file-io-stream) &optional newlen)
(let* ((file-ioblock (basic-stream-ioblock stream)))
(with-ioblock-input-locked (file-ioblock)
- (%ioblock-output-file-length file-ioblock newlen))))
+ (let* ((res (%ioblock-output-file-length file-ioblock newlen)))
+ (and res (>=3D res 0) res)))))
=
(defun close-file-stream (s abort)
(when (open-stream-p s)
More information about the Openmcl-cvs-notifications
mailing list