get-u8 and lookahead-u8 did not update the port position properly.

Fixed.
This commit is contained in:
Abdulaziz Ghuloum 2008-07-23 11:15:44 -07:00
parent 9f623124d5
commit 0305537374
3 changed files with 7 additions and 16 deletions

Binary file not shown.

View File

@ -1177,21 +1177,12 @@
(import UNSAFE)
(define (get-u8-byte-mode p who start)
(when ($port-closed? p) (die who "port is closed" p))
(let* ([bv ($port-buffer p)]
[n (bytevector-length bv)])
(let ([j (($port-read! p) bv 0 n)])
(unless (fixnum? j)
(die who "invalid return value from read! procedure" j))
(cond
[(fx> j 0)
(unless (fx<= j n)
(die who "read! returned a value out of range" j))
($set-port-index! p start)
($set-port-size! p j)
(bytevector-u8-ref bv 0)]
[(fx= j 0) (eof-object)]
[else
(die who "read! returned a value out of range" j)]))))
(let ([cnt (refill-bv-buffer p who)])
(cond
[(eqv? cnt 0) (eof-object)]
[else
($set-port-index! p start)
(bytevector-u8-ref ($port-buffer p) 0)])))
(define (slow-get-u8 p who start)
(assert-binary-input-port p who)
($set-port-attrs! p fast-get-byte-tag)

View File

@ -1 +1 @@
1548
1549