Skip to content
Snippets Groups Projects
Commit b8b7b498 authored by rtoy's avatar rtoy
Browse files

Oops. The string buffer contains characters, so to get the correct

file position, we need to convert what's left in the buffer into
octets to figure out how many octets haven't been delivered yet.
parent 1a712ca4
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain. ;;; Carnegie Mellon University, and has been placed in the public domain.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream.lisp,v 1.93 2010/01/22 06:14:19 rtoy Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/fd-stream.lisp,v 1.94 2010/01/22 13:28:26 rtoy Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -1667,10 +1667,18 @@ ...@@ -1667,10 +1667,18 @@
(fd-stream-ibuf-head stream))) (fd-stream-ibuf-head stream)))
#+unicode #+unicode
(if (fd-stream-string-buffer stream) (if (fd-stream-string-buffer stream)
(decf posn (- (fd-stream-string-buffer-len stream) ;; The string buffer contains Lisp characters,
(fd-stream-string-index stream))) ;; not octets! To figure out how many octets
;; have not been already supplied, we need to
;; convert them back to the encoded format and
;; count the number of octets.
(decf posn (length
(string-encode (subseq (fd-stream-string-buffer stream)
(fd-stream-string-index stream)
(fd-stream-string-buffer-len stream))
(fd-stream-external-format stream))))
(decf posn (- (fd-stream-ibuf-tail stream) (decf posn (- (fd-stream-ibuf-tail stream)
(fd-stream-ibuf-head stream)))) (fd-stream-ibuf-head stream))))
(when (fd-stream-unread stream) ;;@@ (when (fd-stream-unread stream) ;;@@
(decf posn)) (decf posn))
;; Divide bytes by element size. ;; Divide bytes by element size.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment