For Supported Strategies, Attach Dict Even When Params Don't Match

dev
W. Felix Handte 2018-08-27 13:21:01 -07:00
parent 01ff945eae
commit eae8232f50
1 changed files with 4 additions and 2 deletions

View 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,