diff --git a/fd-stream.lisp b/fd-stream.lisp
index 40f85bc..bffd501 100644
--- a/fd-stream.lisp
+++ b/fd-stream.lisp
@@ -26,20 +26,20 @@
:reader stream-fd
:type file-descriptor)
(blocking-p :initarg :blocking-p
- :type boolean))
+ :type boolean))
(:documentation "Base class for file descriptor streams."))
(defmethod stream-blocking-p ((stream fd-stream))
(or (when (slot-boundp stream 'blocking-p)
- (slot-value stream 'blocking-p))
+ (slot-value stream 'blocking-p))
(setf (slot-value stream 'blocking-p)
- (let ((flags (fcntl:getfl (stream-fd stream))))
- (not (= 0 (logand fcntl:+o-nonblock+ flags)))))))
+ (let ((flags (fcntl:getfl (stream-fd stream))))
+ (not (= 0 (logand fcntl:+o-nonblock+ flags)))))))
(defmethod (setf stream-blocking-p) (value (stream fd-stream))
(let* ((fd (stream-fd stream))
- (flags (fcntl:getfl fd))
- (o-nonblock (not (= 0 (logand fcntl:+o-nonblock+ flags)))))
+ (flags (fcntl:getfl fd))
+ (o-nonblock (not (= 0 (logand fcntl:+o-nonblock+ flags)))))
(cond
((and value o-nonblock)
t)
@@ -47,8 +47,8 @@
nil)
(t
(fcntl:setfl fd (if value
- (logand (lognot fcntl:+o-nonblock+) flags)
- (logior fcntl:+o-nonblock+ flags)))
+ (logand (lognot fcntl:+o-nonblock+) flags)
+ (logior fcntl:+o-nonblock+ flags)))
(setf (slot-value stream 'blocking-p) value)))))
(defmethod stream-element-type ((stream fd-stream))
@@ -67,22 +67,22 @@
(defmethod stream-fill-input-buffer ((stream fd-input-stream))
(let* ((buffer (stream-input-buffer stream))
- (length (stream-input-length stream))
- (fd (stream-fd stream))
- (buf (cffi:mem-aptr buffer :unsigned-char length))
- (buflen (- (stream-input-buffer-size stream) length))
- (r (if (stream-blocking-p stream)
- (unistd:read fd buf buflen)
- (unistd:read-non-blocking fd buf buflen))))
+ (length (stream-input-length stream))
+ (fd (stream-fd stream))
+ (buf (cffi:mem-aptr buffer :unsigned-char length))
+ (buflen (- (stream-input-buffer-size stream) length))
+ (r (if (stream-blocking-p stream)
+ (unistd:read fd buf buflen)
+ (unistd:read-non-blocking fd buf buflen))))
(cond ((eq :non-blocking r)
- :non-blocking)
- ((= r 0)
- :eof)
- ((< r 0)
- (error 'stream-input-error :stream stream))
- (t
- (incf (stream-input-length stream) r)
- r))))
+ :non-blocking)
+ ((= r 0)
+ :eof)
+ ((< r 0)
+ (error 'stream-input-error :stream stream))
+ (t
+ (incf (stream-input-length stream) r)
+ r))))
(defmethod close ((stream fd-input-stream))
(call-next-method)
@@ -102,25 +102,25 @@
(defmethod stream-flush-output-buffer ((stream fd-output-stream))
(let ((buffer (stream-output-buffer stream)))
(let* ((fd (stream-fd stream))
- (index (stream-output-index stream))
- (buf (cffi:mem-aptr buffer :unsigned-char index))
- (buflen (- (stream-output-length stream) index))
- (r (if (stream-blocking-p stream)
- (unistd:write fd buf buflen)
- (unistd:write-non-blocking fd buf buflen))))
+ (index (stream-output-index stream))
+ (buf (cffi:mem-aptr buffer :unsigned-char index))
+ (buflen (- (stream-output-length stream) index))
+ (r (if (stream-blocking-p stream)
+ (unistd:write fd buf buflen)
+ (unistd:write-non-blocking fd buf buflen))))
(cond ((eq :non-blocking r)
- :non-blocking)
- ((= 0 r)
- :eof)
- ((< r 0)
- (error 'stream-output-error :stream stream))
- (t
- (incf (stream-output-index stream) r)
- (when (= (stream-output-index stream)
- (stream-output-length stream))
- (setf (stream-output-index stream) 0
- (stream-output-length stream) 0))
- nil)))))
+ :non-blocking)
+ ((= 0 r)
+ :eof)
+ ((< r 0)
+ (error 'stream-output-error :stream stream))
+ (t
+ (incf (stream-output-index stream) r)
+ (when (= (stream-output-index stream)
+ (stream-output-length stream))
+ (setf (stream-output-index stream) 0
+ (stream-output-length stream) 0))
+ nil)))))
(defmethod close ((stream fd-output-stream))
(flush stream)