Author: nextgens
Date: 2008-04-03 08:28:04 +0000 (Thu, 03 Apr 2008)
New Revision: 18943
Modified:
trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
trunk/freenet/src/freenet/support/io/BaseFileBucket.java
Log:
I'm not sure whether the order of the multiplication has some importance or not
but it's better to assume it has
Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
2008-04-03 08:19:51 UTC (rev 18942)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcher.java
2008-04-03 08:28:04 UTC (rev 18943)
@@ -79,7 +79,7 @@
if(splitfileDataBlocks[i] == null) throw new
MetadataParseException("Null: data block "+i+" of "+splitfileDataBlocks.length);
for(int i=0;i<splitfileCheckBlocks.length;i++)
if(splitfileCheckBlocks[i] == null) throw new
MetadataParseException("Null: check block "+i+" of
"+splitfileCheckBlocks.length);
- long finalLength = splitfileDataBlocks.length *
CHKBlock.DATA_LENGTH * 1L;
+ long finalLength = 1L * splitfileDataBlocks.length *
CHKBlock.DATA_LENGTH;
if(finalLength > overrideLength) {
if(finalLength - overrideLength > CHKBlock.DATA_LENGTH)
throw new
FetchException(FetchException.INVALID_METADATA, "Splitfile is "+finalLength+"
but length is "+finalLength);
Modified: trunk/freenet/src/freenet/support/io/BaseFileBucket.java
===================================================================
--- trunk/freenet/src/freenet/support/io/BaseFileBucket.java 2008-04-03
08:19:51 UTC (rev 18942)
+++ trunk/freenet/src/freenet/support/io/BaseFileBucket.java 2008-04-03
08:28:04 UTC (rev 18943)
@@ -373,7 +373,7 @@
Bucket[] buckets = new Bucket[bucketCount];
File file = getFile();
for(int i=0;i<buckets.length;i++) {
- long startAt = i * splitSize * 1L;
+ long startAt = 1L * i * splitSize;
long endAt = Math.min(startAt + splitSize * 1L, length);
long len = endAt - startAt;
buckets[i] = new ReadOnlyFileSliceBucket(file, startAt,
len);