]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Correct literalsRead calculation to include longLength
authorsenhuang42 <senhuang96@fb.com>
Thu, 29 Oct 2020 18:49:37 +0000 (14:49 -0400)
committersenhuang42 <senhuang96@fb.com>
Thu, 29 Oct 2020 18:49:37 +0000 (14:49 -0400)
lib/compress/zstd_compress.c

index 93bfed4da4c7681fa06044174f01d58290bb9c2a..f18880cab48e1dc36392fcf13ff1eebe99cd64a6 100644 (file)
@@ -2456,7 +2456,6 @@ static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc)
     /* Ensure we have enough space for last literals "sequence" */
     assert(zc->seqCollector.maxSequences >= seqStoreSeqSize + 1);
     for (i = 0; i < seqStoreSeqSize; ++i) {
-        literalsRead += seqStoreSeqs[i].litLength;
         outSeqs[i].litLength = seqStoreSeqs[i].litLength;
         outSeqs[i].matchLength = seqStoreSeqs[i].matchLength + MINMATCH;
 
@@ -2487,6 +2486,7 @@ static void ZSTD_copyBlockSequences(ZSTD_CCtx* zc)
         } else {
             outSeqs[i].offset = seqStoreSeqs[i].offset - ZSTD_REP_NUM;
         }
+        literalsRead += outSeqs[i].litLength;
     }
 
     /* Insert last literals (if any exist) in the block as a sequence with ml == off == 0 */