Fix setParameter not falling back to default compression level on 0 value
See documentation for `ZSTD_c_compressionLevel`: `Special: value 0 means default, which is controlled by ZSTD_CLEVEL_DEFAULT`
This commit is contained in:
@@ -540,7 +540,9 @@ size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams,
|
|||||||
|
|
||||||
case ZSTD_c_compressionLevel : {
|
case ZSTD_c_compressionLevel : {
|
||||||
FORWARD_IF_ERROR(ZSTD_cParam_clampBounds(param, &value), "");
|
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;
|
CCtxParams->compressionLevel = value;
|
||||||
}
|
}
|
||||||
if (CCtxParams->compressionLevel >= 0) return (size_t)CCtxParams->compressionLevel;
|
if (CCtxParams->compressionLevel >= 0) return (size_t)CCtxParams->compressionLevel;
|
||||||
|
|||||||
Reference in New Issue
Block a user