mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-15 08:47:35 +02:00
Bugfix - Allow read-bytevector to return EOF
This commit is contained in:
parent
12489dcea5
commit
9a464e002e
1 changed files with 3 additions and 6 deletions
|
@ -709,11 +709,6 @@
|
||||||
(if (null? port)
|
(if (null? port)
|
||||||
(Cyc-display str (current-output-port))
|
(Cyc-display str (current-output-port))
|
||||||
(Cyc-display str (car port))))
|
(Cyc-display str (car port))))
|
||||||
(define (read-bytevector k . _port)
|
|
||||||
(let ((port (if (null? _port)
|
|
||||||
(current-input-port)
|
|
||||||
(car _port))))
|
|
||||||
'test))
|
|
||||||
(define (read-bytevector k . _port)
|
(define (read-bytevector k . _port)
|
||||||
(letrec ((port (if (null? port)
|
(letrec ((port (if (null? port)
|
||||||
(current-input-port)
|
(current-input-port)
|
||||||
|
@ -723,7 +718,9 @@
|
||||||
(let ((b (read-u8 port)))
|
(let ((b (read-u8 port)))
|
||||||
(cond
|
(cond
|
||||||
((eof-object? b)
|
((eof-object? b)
|
||||||
(bytevector-copy bv 0 n))
|
(if (zero? n)
|
||||||
|
b ;; EOF
|
||||||
|
(bytevector-copy bv 0 n)))
|
||||||
((< n k)
|
((< n k)
|
||||||
(bytevector-u8-set! bv n b)
|
(bytevector-u8-set! bv n b)
|
||||||
(loop (+ n 1)))
|
(loop (+ n 1)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue