From: Chris Hanson Date: Wed, 11 Jan 2017 03:36:33 +0000 (-0800) Subject: Fix bugs exposed by testing. X-Git-Tag: mit-scheme-pucked-9.2.12~227^2~168 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=9e78c8191ada303e4ccb61637cfdaaa47318f8d2;p=mit-scheme.git Fix bugs exposed by testing. --- 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