Author: toad
Date: 2006-01-24 23:59:56 +0000 (Tue, 24 Jan 2006)
New Revision: 7910

Modified:
   trunk/freenet/src/freenet/client/FileInserter.java
   trunk/freenet/src/freenet/keys/Key.java
   trunk/freenet/src/freenet/node/Version.java
Log:
375: fix another compression bug

Modified: trunk/freenet/src/freenet/client/FileInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/FileInserter.java  2006-01-24 20:54:14 UTC 
(rev 7909)
+++ trunk/freenet/src/freenet/client/FileInserter.java  2006-01-24 23:59:56 UTC 
(rev 7910)
@@ -170,7 +170,7 @@
                                } else {
                                        if(origSize > 
ClientCHKBlock.MAX_LENGTH_BEFORE_COMPRESSION)
                                                throw new 
IllegalArgumentException("Data too big to compress into single block, but it 
does");
-                                       chk = ClientCHKBlock.encode(data, 
metadata, false, bestCodec.codecNumberForMetadata(), (int)origSize);
+                                       chk = ClientCHKBlock.encode(data, 
metadata, true, bestCodec.codecNumberForMetadata(), (int)origSize);
                                }
                        } catch (IOException e) {
                                throw new 
InserterException(InserterException.BUCKET_ERROR, e, null);

Modified: trunk/freenet/src/freenet/keys/Key.java
===================================================================
--- trunk/freenet/src/freenet/keys/Key.java     2006-01-24 20:54:14 UTC (rev 
7909)
+++ trunk/freenet/src/freenet/keys/Key.java     2006-01-24 23:59:56 UTC (rev 
7910)
@@ -134,10 +134,11 @@
         short compressionAlgorithm = -1;
         // Try to compress it - even if it fits into the block,
         // because compressing it improves its entropy.
-        boolean compressed = false;
         if(sourceData.size() > MAX_LENGTH_BEFORE_COMPRESSION)
             throw new KeyEncodeException("Too big");
-        if(!dontCompress) {
+        if(alreadyCompressedCodec != -1) {
+               compressionAlgorithm = alreadyCompressedCodec;
+        } else if(!dontCompress) {
                byte[] cbuf = null;
                if(alreadyCompressedCodec >= 0) {
                        if(sourceData.size() > MAX_COMPRESSED_DATA_LENGTH)

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-01-24 20:54:14 UTC (rev 
7909)
+++ trunk/freenet/src/freenet/node/Version.java 2006-01-24 23:59:56 UTC (rev 
7910)
@@ -20,7 +20,7 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       public static final int buildNumber = 374;
+       public static final int buildNumber = 375;

        /** Oldest build of Fred we will talk to */
        public static final int lastGoodBuild = 374;


Reply via email to