From e8f64b3f83455a82edad394c472481fadde6ccb5 Mon Sep 17 00:00:00 2001
From: Raymond Toy <toy.raymond@gmail.com>
Date: Tue, 26 Feb 2013 20:44:18 -0800
Subject: [PATCH] Fix ticket:74

When accounting for the octets left in the in-buffer that we haven't
read (or converted to characters), we were subtracting the index from
the total in-buffer length.  This is wrong if the file is less than
the total in-buffer length.  We should have subtracted from the actual
number of octets in the in-buffer.
---
 src/code/fd-stream.lisp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/code/fd-stream.lisp b/src/code/fd-stream.lisp
index e41b33193..7fcd0bca8 100644
--- a/src/code/fd-stream.lisp
+++ b/src/code/fd-stream.lisp
@@ -1756,8 +1756,9 @@
 		   #+nil
 		   (progn
 		     (format t "in-buffer-length = ~D~%" in-buffer-length)
+		     (format t "in-length = ~D~%" (fd-stream-in-length stream))
 		     (format t "fd-stream-in-index = ~D~%" (fd-stream-in-index stream)))
-		   (decf posn (- in-buffer-length
+		   (decf posn (- (fd-stream-in-length stream)
 				 (fd-stream-in-index stream))))
 		 #+nil
 		 (format t "fd-stream-unread = ~S~%" (fd-stream-unread stream))
-- 
GitLab