]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
[minor improvement] Pass dictSize when selecting parameters
authorNick Terrell <terrelln@fb.com>
Mon, 5 Oct 2020 22:49:55 +0000 (15:49 -0700)
committerNick Terrell <terrelln@fb.com>
Mon, 12 Oct 2020 19:47:19 +0000 (12:47 -0700)
When selecting parameters in streaming compression with a dictionary use
the dictionary size to select the parameters.

lib/compress/zstd_compress.c

index 3e0339683b344fa32bba6d1093f87f6e00ab8672..b0f0e9eaad88daca91b47a2a0cc3e675f13b224c 100644 (file)
@@ -4109,7 +4109,9 @@ size_t ZSTD_compressStream2( ZSTD_CCtx* cctx,
             params.compressionLevel = cctx->cdict->compressionLevel; /* let cdict take priority in terms of compression level */
         DEBUGLOG(4, "ZSTD_compressStream2 : transparent init stage");
         if (endOp == ZSTD_e_end) cctx->pledgedSrcSizePlusOne = input->size + 1;  /* auto-fix pledgedSrcSize */
-        params.cParams = ZSTD_getCParamsFromCCtxParams(&params, cctx->pledgedSrcSizePlusOne-1, 0 /*dictSize*/);
+        params.cParams = ZSTD_getCParamsFromCCtxParams(
+                &params, cctx->pledgedSrcSizePlusOne-1,
+                cctx->prefixDict.dict ? cctx->prefixDict.dictSize : (cctx->cdict ? cctx->cdict->dictContentSize : 0));
 
 
 #ifdef ZSTD_MULTITHREAD