Commit 540e158a authored by Eric Timmons's avatar Eric Timmons
Browse files

Too many things named OFFSET

parent eae3d081
Pipeline #4668 passed with stage
in 8 minutes and 2 seconds
......@@ -30,7 +30,7 @@
instantiated.")
(offset
:initform 0
:accessor offset
:accessor stream-offset
:documentation
"The number of bytes between the start of the buffer and
START-FILE-POSITION.")
......@@ -115,7 +115,7 @@ the wrapped stream is in the correct place."
the buffer to be written."
(when (dirty-p stream)
(let ((current-position (file-position (wrapped-stream stream)))
(desired-position (+ (offset stream) (start-file-position stream))))
(desired-position (+ (stream-offset stream) (start-file-position stream))))
(unless (= current-position desired-position)
(unless (file-position (wrapped-stream stream) desired-position)
(error 'simple-blocked-stream-error
......@@ -148,12 +148,12 @@ the buffer to be written."
((= (index stream) (block-size stream))
(discard-buffer stream)
(setf (index stream) 0)
(incf (offset stream) (block-size stream))
(incf (stream-offset stream) (block-size stream))
(fill-buffer stream))
((> (index stream) (block-size stream))
(discard-buffer stream)
(decf (index stream) (block-size stream))
(incf (offset stream) (block-size stream))
(incf (stream-offset stream) (block-size stream))
(ensure-buffer-valid stream))))
(defmethod trivial-gray-streams:stream-read-byte ((stream blocked-input-stream))
......@@ -214,7 +214,7 @@ the buffer to be written."
(+ start num-bytes-remaining) end))))
(defmethod trivial-gray-streams:stream-file-position ((stream blocked-stream))
(+ (index stream) (offset stream)))
(+ (index stream) (stream-offset stream)))
(defmethod stream-element-type ((stream blocked-stream))
(stream-element-type (wrapped-stream stream)))
......@@ -225,26 +225,26 @@ the buffer to be written."
(new-index (- newval start-of-chunk-position)))
(flet ((read-forward ()
(loop
:while (/= (offset stream) start-of-chunk-position)
:while (/= (stream-offset stream) start-of-chunk-position)
:do
(discard-buffer stream)
(setf (index stream) (block-size stream))
(ensure-buffer-valid))))
(cond
((and (= start-of-chunk-position (offset stream))
((and (= start-of-chunk-position (stream-offset stream))
(or (null (eof-index stream))
(< new-index (eof-index stream))))
;; We've been asked to seek to a position already within our buffer
;; *and* is not beyond the EOF.
(setf (index stream) new-index)
t)
((= start-of-chunk-position (offset stream))
((= start-of-chunk-position (stream-offset stream))
;; We've been asked to seek beyond the EOF.
(error 'simple-blocked-stream-error
:stream stream
:format-control "Attempted to move beyond the end of the stream."))
((and (null (start-file-position stream))
(> start-of-chunk-position (offset stream)))
(> start-of-chunk-position (stream-offset stream)))
;; We can't use FILE-POSITION directly to seek because we couldn't
;; determine the starting FILE-POSITION of the wrapped stream. However,
;; we want to seek forward, so we can just read blocks until we get
......@@ -262,9 +262,9 @@ the buffer to be written."
start-of-chunk-position))
(progn
(setf (index stream) new-index
(offset stream) start-of-chunk-position)
(stream-offset stream) start-of-chunk-position)
t)
(when (> start-of-chunk-position (offset stream))
(when (> start-of-chunk-position (stream-offset stream))
(read-forward)
t)))))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment