Use ZSTD_CCtxParams_init() to Init CCtxParams, not memset()
Even if the discrepancies are at the moment benign, it's probably better to standardize on using the one true initializer, rather than trying (and failing) to correctly duplicate its behavior.
This commit is contained in:
parent
e8a44326fa
commit
8930c6e551
@ -192,11 +192,10 @@ static ZSTD_CCtx_params ZSTD_makeCCtxParamsFromCParams(
|
||||
ZSTD_compressionParameters cParams)
|
||||
{
|
||||
ZSTD_CCtx_params cctxParams;
|
||||
ZSTD_memset(&cctxParams, 0, sizeof(cctxParams));
|
||||
/* should not matter, as all cParams are presumed properly defined */
|
||||
ZSTD_CCtxParams_init(&cctxParams, ZSTD_CLEVEL_DEFAULT);
|
||||
cctxParams.cParams = cParams;
|
||||
cctxParams.compressionLevel = ZSTD_CLEVEL_DEFAULT; /* should not matter, as all cParams are presumed properly defined */
|
||||
assert(!ZSTD_checkCParams(cParams));
|
||||
cctxParams.fParams.contentSizeFlag = 1;
|
||||
return cctxParams;
|
||||
}
|
||||
|
||||
@ -208,9 +207,8 @@ static ZSTD_CCtx_params* ZSTD_createCCtxParams_advanced(
|
||||
params = (ZSTD_CCtx_params*)ZSTD_customCalloc(
|
||||
sizeof(ZSTD_CCtx_params), customMem);
|
||||
if (!params) { return NULL; }
|
||||
ZSTD_CCtxParams_init(params, ZSTD_CLEVEL_DEFAULT);
|
||||
params->customMem = customMem;
|
||||
params->compressionLevel = ZSTD_CLEVEL_DEFAULT;
|
||||
params->fParams.contentSizeFlag = 1;
|
||||
return params;
|
||||
}
|
||||
|
||||
@ -3637,7 +3635,7 @@ const ZSTD_CDict* ZSTD_initStaticCDict(
|
||||
(unsigned)workspaceSize, (unsigned)neededSize, (unsigned)(workspaceSize < neededSize));
|
||||
if (workspaceSize < neededSize) return NULL;
|
||||
|
||||
ZSTD_memset(¶ms, 0, sizeof(params));
|
||||
ZSTD_CCtxParams_init(¶ms, 0);
|
||||
params.cParams = cParams;
|
||||
|
||||
if (ZSTD_isError( ZSTD_initCDict_internal(cdict,
|
||||
|
Loading…
x
Reference in New Issue
Block a user