Re: [iolib-devel] Problem with peek-char
On Thu, 2010-03-25 at 12:53 +0300, Andrey Moskvitin wrote:
Hi,
I'm not sure that this is a bug.
Yes, I sorted out problem more deeply and concluded that in stream-read-char required following changes:
diff --git a/src/streams/gray/gray-stream-methods.lisp b/src/streams/gray/gray-stream-methods.lisp index 49c2eb1..45a25d1 100644 --- a/src/streams/gray/gray-stream-methods.lisp +++ b/src/streams/gray/gray-stream-methods.lisp @@ -332,7 +332,8 @@ (return* :eof)))) (cond ((zerop (iobuf-length ib)) (iobuf-reset ib) - (fill-buf-or-eof)) + (fill-buf-or-eof) + (setf unread-index (iobuf-start ib))) ;; Some encodings such as CESU or Java's modified UTF-8 take ;; as much as 6 bytes per character. Make sure we have enough ;; space to collect read-ahead bytes if required.
Since the old code was very hard to read in order to understand what was the bug, I rewrote it. Could you please try again ? -- Stelian Ionescu a.k.a. fe[nl]ix Quidquid latine dictum sit, altum videtur. http://common-lisp.net/project/iolib
participants (1)
-
Stelian Ionescu