Add enum to decision process

dev
Sen Huang 2019-10-20 19:02:47 -04:00
parent 1daa898c93
commit 6d297265f9
2 changed files with 4 additions and 3 deletions

View File

@ -2909,7 +2909,7 @@ static size_t ZSTD_compressBegin_internal(ZSTD_CCtx* cctx,
if ( (cdict) if ( (cdict)
&& (cdict->dictContentSize > 0) && (cdict->dictContentSize > 0)
&& (pledgedSrcSize < ZSTD_USE_CDICT_PARAMS_CUTOFF || cdict->compressionLevel == 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); 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"); DEBUGLOG(4, "ZSTD_compressBegin_usingCDict_advanced");
RETURN_ERROR_IF(cdict==NULL, dictionary_wrong); RETURN_ERROR_IF(cdict==NULL, dictionary_wrong);
{ ZSTD_CCtx_params params = cctx->requestedParams; { 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_getCParamsFromCDict(cdict)
: ZSTD_getCParams(cdict->compressionLevel, : ZSTD_getCParams(cdict->compressionLevel,
pledgedSrcSize, pledgedSrcSize,

View File

@ -1177,7 +1177,7 @@ typedef enum {
ZSTD_dictDefaultAttach = 0, /* Use the default heuristic. */ ZSTD_dictDefaultAttach = 0, /* Use the default heuristic. */
ZSTD_dictForceAttach = 1, /* Never copy the dictionary. */ ZSTD_dictForceAttach = 1, /* Never copy the dictionary. */
ZSTD_dictForceCopy = 2, /* Always 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; } ZSTD_dictAttachPref_e;
typedef enum { typedef enum {