From eae8232f50bc7c73bef5fa6074e0781264989bbc Mon Sep 17 00:00:00 2001 From: "W. Felix Handte" Date: Mon, 27 Aug 2018 13:21:01 -0700 Subject: [PATCH] For Supported Strategies, Attach Dict Even When Params Don't Match --- lib/compress/zstd_compress.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 174f1791d..ff49b0c5e 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -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,