From 6d297265f910dc08e99b4bb81a8da22524240305 Mon Sep 17 00:00:00 2001 From: Sen Huang Date: Sun, 20 Oct 2019 19:02:47 -0400 Subject: [PATCH] Add enum to decision process --- lib/compress/zstd_compress.c | 5 +++-- lib/zstd.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index f0e45f51..51e8f59c 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -2909,7 +2909,7 @@ static size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx, if ( (cdict) && (cdict->dictContentSize > 0) && (pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_CUTOFF || cdict->compressionLevel == 0) - && (params->attachDictPref != ZSTD_dictForceInputParams) ) { + && (params->attachDictPref != ZSTD_dictForceSource) ) { return ZSTD_resetCCtx_usingCDict(cctx, cdict, params, pledgedSrcSize, zbuff); } @@ -3348,7 +3348,8 @@ size_t ZSTD_compressBegin_usingCDict_advanced( DEBUGLOG(4, "ZSTD_compressBegin_usingCDict_advanced"); RETURN_ERROR_IF(cdict==NULL, dictionary_wrong); { ZSTD_CCtx_params params = cctx->requestedParams; - params.cParams = (pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_CUTOFF) || (cdict->compressionLevel == 0) ? + params.cParams = ( (pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_CUTOFF) || (cdict->compressionLevel == 0) ) + && (params->attachDictPref != ZSTD_dictForceSource) ? ZSTD_getCParamsFromCDict(cdict) : ZSTD_getCParams(cdict->compressionLevel, pledgedSrcSize, diff --git a/lib/zstd.h b/lib/zstd.h index 4859733b..c0521c1b 100644 --- a/lib/zstd.h +++ b/lib/zstd.h @@ -1177,7 +1177,7 @@ typedef enum { ZSTD_dictDefaultAttach = 0, /* Use the default heuristic. */ ZSTD_dictForceAttach = 1, /* Never copy the dictionary. */ ZSTD_dictForceCopy = 2, /* Always copy the dictionary. */ - ZSTD_dictForceInputParams = 3, /* Always use input to determine tables */ + ZSTD_dictForceSource = 3, /* Always use src input to determine tables */ } ZSTD_dictAttachPref_e; typedef enum {