From 9e78c8191ada303e4ccb61637cfdaaa47318f8d2 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Tue, 10 Jan 2017 19:36:33 -0800 Subject: [PATCH] Fix bugs exposed by testing. --- src/runtime/binary-port.scm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/runtime/binary-port.scm b/src/runtime/binary-port.scm index eeaa85b27..c129ea01d 100644 --- a/src/runtime/binary-port.scm +++ b/src/runtime/binary-port.scm @@ -104,13 +104,15 @@ USA. (make-binary-input-port (make-non-channel-input-source (lambda () - (fix:< start end)) + (fix:<= start end)) (lambda (bv bs be) - (let ((n (fix:min (fix:- end start) (fix:- be bs)))) - (let ((start* (fix:+ start n))) - (bytevector-copy! bv bs bytevector start start*) - (set! start start*)) - n))) + (if (fix:< bs be) + (let ((n (fix:min (fix:- end start) (fix:- be bs)))) + (let ((start* (fix:+ start n))) + (bytevector-copy! bv bs bytevector start start*) + (set! start start*)) + n) + 0))) 'open-input-bytevector))) ;;;; Bytevector output ports -- 2.25.1