]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Decision for Whether to Attach Should be Based on CDict Config, not CCtx
authorW. Felix Handte <w@felixhandte.com>
Thu, 13 Aug 2020 20:52:07 +0000 (16:52 -0400)
committerW. Felix Handte <w@felixhandte.com>
Thu, 10 Sep 2020 22:51:52 +0000 (18:51 -0400)
lib/compress/zstd_compress.c

index c3d317d25900740cc8d0bd7e21221f8deced451d..fc1b42134a16a4474b57a67590f5cbff455b8111 100644 (file)
@@ -1640,10 +1640,8 @@ static int ZSTD_shouldAttachDict(const ZSTD_CDict* cdict,
                                  U64 pledgedSrcSize)
 {
     size_t cutoff = attachDictSizeCutoffs[cdict->matchState.cParams.strategy];
-    int const useDedicatedDictSearch =
-        params->enableDedicatedDictSearch &&
-        ZSTD_dedicatedDictSearch_isSupported(params->compressionLevel, cdict->dictContentSize);
-    return ( useDedicatedDictSearch
+    int const dedicatedDictSearch = cdict->matchState.dedicatedDictSearch;
+    return ( dedicatedDictSearch
           || pledgedSrcSize <= cutoff
           || pledgedSrcSize == ZSTD_CONTENTSIZE_UNKNOWN
           || params->attachDictPref == ZSTD_dictForceAttach )
@@ -1709,6 +1707,8 @@ static size_t ZSTD_resetCCtx_byCopyingCDict(ZSTD_CCtx* cctx,
 {
     const ZSTD_compressionParameters *cdict_cParams = &cdict->matchState.cParams;
 
+    assert(!cdict->matchState.dedicatedDictSearch);
+
     DEBUGLOG(4, "copying dictionary into context");
 
     {   unsigned const windowLog = params.cParams.windowLog;