Author: toad
Date: 2007-02-20 00:45:14 +0000 (Tue, 20 Feb 2007)
New Revision: 11844

Modified:
   trunk/freenet/src/freenet/support/io/ReadOnlyFileSliceBucket.java
Log:
Patch from Anonymous at o9_0DTuZniSf_+oDmRsonByWxsI to fix some possible bugs 
in ROFS.

Modified: trunk/freenet/src/freenet/support/io/ReadOnlyFileSliceBucket.java
===================================================================
--- trunk/freenet/src/freenet/support/io/ReadOnlyFileSliceBucket.java   
2007-02-19 13:41:39 UTC (rev 11843)
+++ trunk/freenet/src/freenet/support/io/ReadOnlyFileSliceBucket.java   
2007-02-20 00:45:14 UTC (rev 11844)
@@ -92,15 +92,15 @@
                }

                public int read() throws IOException {
-                       if(ptr > length)
+                       if(ptr >= length)
                                throw new EOFException();
                        int x = f.read();
-                       ptr++;
+                       if(x != -1) ptr++;
                        return x;
                }

                public int read(byte[] buf, int offset, int len) throws 
IOException {
-                       if(ptr > length)
+                       if(ptr >= length)
                                throw new EOFException();
                        len = (int) Math.min(len, length - ptr);
                        int x = f.read(buf, offset, len);


Reply via email to