pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1686737 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBuffer.java
Date Sun, 21 Jun 2015 15:09:43 GMT
Author: lehmi
Date: Sun Jun 21 15:09:43 2015
New Revision: 1686737

URL: http://svn.apache.org/r1686737
Log:
PDFBOX-2301: seek bugfix

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBuffer.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBuffer.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBuffer.java?rev=1686737&r1=1686736&r2=1686737&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBuffer.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessBuffer.java Sun Jun
21 15:09:43 2015
@@ -173,11 +173,11 @@ public class RandomAccessBuffer implemen
             throw new IOException("Invalid position "+position);
         }
         pointer = position;
-        if (pointer <= size)
+        if (pointer < size)
         {
             // calculate the chunk list index
-            bufferListIndex = (int)(position / chunkSize);
-            currentBufferPointer = (int)(position % chunkSize);
+            bufferListIndex = (int)(pointer / chunkSize);
+            currentBufferPointer = (int)(pointer % chunkSize);
             currentBuffer = bufferList.get(bufferListIndex);
         }
         else
@@ -186,7 +186,7 @@ public class RandomAccessBuffer implemen
             // jump to the end of the buffer
             bufferListIndex = bufferListMaxIndex;
             currentBuffer = bufferList.get(bufferListIndex);
-            currentBufferPointer = (int)(size - ((bufferListMaxIndex-1)*chunkSize));
+            currentBufferPointer = (int)(size % chunkSize);
         }
     }
 



Mime
View raw message