mirror of
https://github.com/facebook/zstd.git
synced 2025-10-08 00:04:02 -04:00
Add initialization/allocation functions for opaque params
This commit is contained in:
parent
ade95b8bed
commit
4169f49171
@ -230,6 +230,44 @@ static ZSTD_CCtx_params ZSTD_makeCCtxParamsFromCParams(
|
|||||||
return cctxParams;
|
return cctxParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ZSTD_CCtx_params* ZSTD_createCCtxParams(void)
|
||||||
|
{
|
||||||
|
ZSTD_CCtx_params* params =
|
||||||
|
(ZSTD_CCtx_params*)ZSTD_calloc(sizeof(ZSTD_CCtx_params),
|
||||||
|
ZSTD_defaultCMem);
|
||||||
|
if (!params) { return NULL; }
|
||||||
|
// TODO
|
||||||
|
// params->compressionLevel = ZSTD_CLEVEL_DEFAULT;
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t ZSTD_initCCtxParams(ZSTD_CCtx_params* params,
|
||||||
|
ZSTD_compressionParameters cParams)
|
||||||
|
{
|
||||||
|
CHECK_F( params == NULL );
|
||||||
|
memset(params, 0, sizeof(ZSTD_CCtx_params));
|
||||||
|
params->cParams = cParams;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ZSTD_CCtx_params* ZSTD_createAndInitCCtxParams(
|
||||||
|
int compressionLevel, unsigned long long estimatedSrcSize,
|
||||||
|
size_t dictSize)
|
||||||
|
{
|
||||||
|
ZSTD_CCtx_params* params = ZSTD_createCCtxParams();
|
||||||
|
if (params == NULL) { return NULL; }
|
||||||
|
ZSTD_initCCtxParams(params, ZSTD_getCParams(
|
||||||
|
compressionLevel, estimatedSrcSize, dictSize));
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params)
|
||||||
|
{
|
||||||
|
ZSTD_free(params, ZSTD_defaultCMem);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static ZSTD_parameters ZSTD_getParamsFromCCtx(const ZSTD_CCtx* cctx) {
|
static ZSTD_parameters ZSTD_getParamsFromCCtx(const ZSTD_CCtx* cctx) {
|
||||||
return ZSTD_getParamsFromCCtxParams(cctx->appliedParams);
|
return ZSTD_getParamsFromCCtxParams(cctx->appliedParams);
|
||||||
|
@ -611,6 +611,12 @@ ZSTDLIB_API ZSTD_CDict* ZSTD_initStaticCDict_advanced_opaque(
|
|||||||
unsigned byReference, ZSTD_dictMode_e dictMode,
|
unsigned byReference, ZSTD_dictMode_e dictMode,
|
||||||
ZSTD_CCtx_params* params);
|
ZSTD_CCtx_params* params);
|
||||||
|
|
||||||
|
ZSTDLIB_API ZSTD_CCtx_params* ZSTD_createCCtxParams(void);
|
||||||
|
ZSTDLIB_API ZSTD_CCtx_params* ZSTD_createAndInitCCtxParams(int compressionLevel, unsigned long long estimatedSrcSize, size_t dictSize);
|
||||||
|
ZSTDLIB_API size_t ZSTD_initCCtxParams(ZSTD_CCtx_params* params, ZSTD_compressionParameters cParams);
|
||||||
|
ZSTDLIB_API size_t ZSTD_freeCCtxParams(ZSTD_CCtx_params* params);
|
||||||
|
|
||||||
|
|
||||||
/*! ZSTD_getCParams() :
|
/*! ZSTD_getCParams() :
|
||||||
* @return ZSTD_compressionParameters structure for a selected compression level and estimated srcSize.
|
* @return ZSTD_compressionParameters structure for a selected compression level and estimated srcSize.
|
||||||
* `estimatedSrcSize` value is optional, select 0 if not known */
|
* `estimatedSrcSize` value is optional, select 0 if not known */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user