commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [2/2] commons-compress git commit: tweaks
Date Thu, 09 Feb 2017 16:37:35 GMT
tweaks


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/e79465bb
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/e79465bb
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/e79465bb

Branch: refs/heads/master
Commit: e79465bbecc6033780f91fd41ab7d66c5e9e7bae
Parents: 982ce0e
Author: Stefan Bodewig <bodewig@apache.org>
Authored: Thu Feb 9 17:37:17 2017 +0100
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Thu Feb 9 17:37:17 2017 +0100

----------------------------------------------------------------------
 .../lz4/FramedLZ4CompressorInputStream.java           | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/e79465bb/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStream.java
b/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStream.java
index 8bf49ac..2f1eabb 100644
--- a/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStream.java
+++ b/src/main/java/org/apache/commons/compress/compressors/lz4/FramedLZ4CompressorInputStream.java
@@ -143,11 +143,13 @@ public class FramedLZ4CompressorInputStream extends CompressorInputStream
{
                 r = readOnce(b, off, len);
             }
         }
-        if (expectBlockDependency) {
-            appendToBlockDependencyBuffer(b, off, r);
-        }
-        if (expectContentChecksum && r != -1) {
-            contentHash.update(b, off, r);
+        if (r != -1) {
+            if (expectBlockDependency) {
+                appendToBlockDependencyBuffer(b, off, r);
+            }
+            if (expectContentChecksum) {
+                contentHash.update(b, off, r);
+            }
         }
         return r;
     }
@@ -165,6 +167,7 @@ public class FramedLZ4CompressorInputStream extends CompressorInputStream
{
         int read = IOUtils.readFully(in, b);
         count(read);
         if (0 == read && !firstFrame) {
+            // good LZ4 frame and nothing after it
             endReached = true;
             return false;
         }
@@ -174,6 +177,7 @@ public class FramedLZ4CompressorInputStream extends CompressorInputStream
{
 
         read = skipSkippableFrame(b);
         if (0 == read && !firstFrame) {
+            // good LZ4 frame with only some skippable frames after it
             endReached = true;
             return false;
         }


Mime
View raw message