]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Fix setting of nextToUpdate at end of ldm matcher
authorStella Lau <laus@fb.com>
Wed, 6 Sep 2017 03:41:37 +0000 (20:41 -0700)
committerStella Lau <laus@fb.com>
Wed, 6 Sep 2017 03:41:37 +0000 (20:41 -0700)
lib/compress/zstd_compress.c

index 7863fae0aad0362a9f7afe7735df70ce8f11d883..bbca6729d3d23fa73b21e32c300457cdf0bb9c6b 100644 (file)
@@ -1030,6 +1030,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
         }
 
         /* ldm space */
+        /* TODO */
         if (params.ldmParams.enableLdm) {
             size_t const ldmHSize = ((size_t)1) << params.ldmParams.hashLog;
             size_t const ldmBucketSize =
@@ -3580,7 +3581,7 @@ size_t ZSTD_compressBlock_ldm_generic(ZSTD_CCtx* cctx,
     ZSTD_ldm_fillFastTables(cctx, anchor);
 
     lastLiterals = blockCompressor(cctx, anchor, iend - anchor);
-    cctx->nextToUpdate = (U32)(ip - base);
+    cctx->nextToUpdate = (U32)(iend - base);
 
     /* Restore seqStorePtr->rep */
     for (i = 0; i < ZSTD_REP_NUM; i++)
@@ -3805,7 +3806,7 @@ static size_t ZSTD_compressBlock_ldm_extDict_generic(
 
     /* Call the block compressor one last time on the last literals */
     lastLiterals = blockCompressor(ctx, anchor, iend - anchor);
-    ctx->nextToUpdate = (U32)(ip - base);
+    ctx->nextToUpdate = (U32)(iend - base);
 
     /* Restore seqStorePtr->rep */
     for (i = 0; i < ZSTD_REP_NUM; i++)