Merge pull request #2291 from i-do-cpp/fix-compression-level-default
Fix setParameter not falling back to default compression level
This commit is contained in:
@@ -540,9 +540,10 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams,
|
||||
|
||||
case ZSTD_c_compressionLevel : {
|
||||
FORWARD_IF_ERROR(ZSTD_cParam_clampBounds(param, &value), "");
|
||||
if (value) { /* 0 : does not change current level */
|
||||
if (value == 0)
|
||||
CCtxParams->compressionLevel = ZSTD_CLEVEL_DEFAULT; /* 0 == default */
|
||||
else
|
||||
CCtxParams->compressionLevel = value;
|
||||
}
|
||||
if (CCtxParams->compressionLevel >= 0) return (size_t)CCtxParams->compressionLevel;
|
||||
return 0; /* return type (size_t) cannot represent negative values */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user