]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Addressing comments on parsing
authorBimba Shrestha <bshrestha.msae@gmail.com>
Tue, 10 Sep 2019 22:10:50 +0000 (15:10 -0700)
committerBimba Shrestha <bshrestha.msae@gmail.com>
Tue, 10 Sep 2019 22:10:50 +0000 (15:10 -0700)
lib/compress/zstd_compress.c
lib/zstd.h

index b4fdf3872c4d7ef38c1b4728e388373ba7c06a72..849a9f42c7f7d56437b595d785b261db2283fc32 100644 (file)
@@ -2288,7 +2288,7 @@ static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc)
         }
 
         if (outSeqs[i].offset <= ZSTD_REP_NUM) {
-            outSeqs[i].rep = 1;
+            outSeqs[i].rep = outSeqs[i].offset;
             repIdx = i - outSeqs[i].offset;
 
             if (outSeqs[i].litLength == 0) {
@@ -2297,10 +2297,11 @@ static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc)
                 } else {
                     repIdx = i - 1;
                 }
+                ++outSeqs[i].rep;
             }
             assert(repIdx >= -3);
             outSeqs[i].offset = repIdx >= 0 ? outSeqs[repIdx].offset : repStartValue[-repIdx - 1];
-            if (outSeqs[i].offset == 3) {
+            if (outSeqs[i].offset == 4) {
                 --outSeqs[i].offset;
             }
         } else {
index b2c66e755f6664216d0c091e02d2fdc12d6dea7a..97feb77d562aa04356ec5c3284cdcf86f6e69b7d 100644 (file)
@@ -1077,7 +1077,7 @@ typedef struct {
     unsigned int offset;
     unsigned int litLength;
     unsigned int matchLength;
-    int rep;
+    unsigned int rep;
 } ZSTD_Sequence;
 
 typedef struct {