From cmucl-devel at common-lisp.net Thu Mar 3 06:18:38 2011 From: cmucl-devel at common-lisp.net (cmucl) Date: Thu, 03 Mar 2011 06:18:38 -0000 Subject: [cmucl-ticket] [cmucl] #43: unread-char doesn't change file-position Message-ID: <052.a1f34f9585c81059d038bafe5751e955@common-lisp.net> #43: unread-char doesn't change file-position ---------------------+------------------------------------------------------ Reporter: rtoy | Owner: Type: defect | Status: new Priority: major | Milestone: Component: Unicode | Version: 20b Keywords: | ---------------------+------------------------------------------------------ This test is from Douglas Crosher, on the maxima mailing list. {{{ (with-open-file (ostream "ctest.txt" :direction :output :external-format #+clisp "utf-8" #-clisp :utf-8) (dotimes (i 1000) (write-char (code-char #x1234) ostream))) (with-open-file (stream "ctest.txt" :direction :input :external-format #+clisp "utf-8" #-clisp :utf-8) (let ((p0 (file-position stream)) (ch (read-char stream))) (unread-char ch stream) (let ((p0* (file-position stream))) (if (eql p0* p0) "Ok" "Broken")))) }}} Cmucl returns "Broken" because {{{p0}}} = 0 but {{{p0*}}} = 2. I think {{{unread-char}}} didn't update everything needed by our unicode stream buffers. -- Ticket URL: cmucl Cmucl is a high-performance, free Common Lisp implementation. From cmucl-devel at common-lisp.net Thu Mar 3 16:46:18 2011 From: cmucl-devel at common-lisp.net (cmucl) Date: Thu, 03 Mar 2011 16:46:18 -0000 Subject: [cmucl-ticket] [cmucl] #43: unread-char doesn't change file-position In-Reply-To: <052.a1f34f9585c81059d038bafe5751e955@common-lisp.net> References: <052.a1f34f9585c81059d038bafe5751e955@common-lisp.net> Message-ID: <061.265f34dd63786fed9016e39cd362dec0@common-lisp.net> #43: unread-char doesn't change file-position ----------------------+----------------------------------------------------- Reporter: rtoy | Owner: Type: defect | Status: closed Priority: major | Milestone: Component: Unicode | Version: 20b Resolution: fixed | Keywords: ----------------------+----------------------------------------------------- Changes (by rtoy): * status: new => closed * resolution: => fixed Comment: Fixed and should be available in the April snapshot. The issue was caused by {{{FAST-READ-CHAR-STRING-REFILL}}} not updating the ibuf head pointer when some octets in the buffer were not converted to characters because the last octets in the buffer do not form a complete character. -- Ticket URL: cmucl Cmucl is a high-performance, free Common Lisp implementation.