]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
For Supported Strategies, Attach Dict Even When Params Don't Match
authorW. Felix Handte <w@felixhandte.com>
Mon, 27 Aug 2018 20:21:01 +0000 (13:21 -0700)
committerW. Felix Handte <w@felixhandte.com>
Sat, 29 Sep 2018 00:12:54 +0000 (17:12 -0700)
lib/compress/zstd_compress.c

index 174f1791d0e8cc74fb09a6ad04e98152cc0a5734..ff49b0c5e2368e60fa949a4bc8c18787f5a7b0d8 100644 (file)
@@ -1330,8 +1330,10 @@ static int ZSTD_shouldAttachDict(ZSTD_CCtx* cctx,
         && params.attachDictPref != ZSTD_dictForceCopy
         && !params.forceWindow /* dictMatchState isn't correctly
                                 * handled in _enforceMaxDist */
-        && ZSTD_equivalentCParams(cctx->appliedParams.cParams,
-                                  cdict->matchState.cParams);
+        && ( (cdict->matchState.cParams.strategy <= ZSTD_fast)
+          || (cdict->matchState.cParams.strategy > ZSTD_fast &&
+              ZSTD_equivalentCParams(cctx->appliedParams.cParams,
+                                     cdict->matchState.cParams)));
 }
 
 static size_t ZSTD_resetCCtx_byAttachingCDict(ZSTD_CCtx* cctx,