[armedbear-cvs] r11985 - trunk/abcl/src/org/armedbear/lisp/util

Erik Huelsmann ehuelsmann at common-lisp.net
Mon Jun 1 20:55:33 UTC 2009


Author: ehuelsmann
Date: Mon Jun  1 16:55:31 2009
New Revision: 11985

Log:
We can't move beyond position() in bbuf if it's not readable,
set the seek() limits accordingly.

Modified:
   trunk/abcl/src/org/armedbear/lisp/util/RandomAccessCharacterFile.java

Modified: trunk/abcl/src/org/armedbear/lisp/util/RandomAccessCharacterFile.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/util/RandomAccessCharacterFile.java	(original)
+++ trunk/abcl/src/org/armedbear/lisp/util/RandomAccessCharacterFile.java	Mon Jun  1 16:55:31 2009
@@ -403,7 +403,8 @@
 
     public final void position(long newPosition) throws IOException {
         flushBbuf();
-        long bbufend = bbufpos + bbuf.limit();
+        long bbufend = bbufpos + // in case bbuf is readable, its contents is valid
+            bbufIsReadable ? bbuf.limit() : bbuf.position(); // beyond position()
         if (newPosition >= bbufpos && newPosition < bbufend) {
             // near seek. within existing data of bbuf.
             bbuf.position((int)(newPosition - bbufpos));




More information about the armedbear-cvs mailing list