[libzstd] Rename ZSTD_CCtxParam_* to ZSTD_CCtxParams_*
This commit is contained in:
parent
eb3a7a3827
commit
7ad7ba3178
@ -494,13 +494,13 @@ size_t ZSTD_CCtx_setParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int value)
|
|||||||
|
|
||||||
default: RETURN_ERROR(parameter_unsupported);
|
default: RETURN_ERROR(parameter_unsupported);
|
||||||
}
|
}
|
||||||
return ZSTD_CCtxParam_setParameter(&cctx->requestedParams, param, value);
|
return ZSTD_CCtxParams_setParameter(&cctx->requestedParams, param, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ZSTD_CCtxParam_setParameter(ZSTD_CCtx_params* CCtxParams,
|
size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* CCtxParams,
|
||||||
ZSTD_cParameter param, int value)
|
ZSTD_cParameter param, int value)
|
||||||
{
|
{
|
||||||
DEBUGLOG(4, "ZSTD_CCtxParam_setParameter (%i, %i)", (int)param, value);
|
DEBUGLOG(4, "ZSTD_CCtxParams_setParameter (%i, %i)", (int)param, value);
|
||||||
switch(param)
|
switch(param)
|
||||||
{
|
{
|
||||||
case ZSTD_c_format :
|
case ZSTD_c_format :
|
||||||
@ -670,10 +670,10 @@ size_t ZSTD_CCtxParam_setParameter(ZSTD_CCtx_params* CCtxParams,
|
|||||||
|
|
||||||
size_t ZSTD_CCtx_getParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int* value)
|
size_t ZSTD_CCtx_getParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param, int* value)
|
||||||
{
|
{
|
||||||
return ZSTD_CCtxParam_getParameter(&cctx->requestedParams, param, value);
|
return ZSTD_CCtxParams_getParameter(&cctx->requestedParams, param, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ZSTD_CCtxParam_getParameter(
|
size_t ZSTD_CCtxParams_getParameter(
|
||||||
ZSTD_CCtx_params* CCtxParams, ZSTD_cParameter param, int* value)
|
ZSTD_CCtx_params* CCtxParams, ZSTD_cParameter param, int* value)
|
||||||
{
|
{
|
||||||
switch(param)
|
switch(param)
|
||||||
|
@ -672,7 +672,7 @@ static void ZSTDMT_compressionJob(void* jobDescription)
|
|||||||
if (ZSTD_isError(initError)) JOB_ERROR(initError);
|
if (ZSTD_isError(initError)) JOB_ERROR(initError);
|
||||||
} else { /* srcStart points at reloaded section */
|
} else { /* srcStart points at reloaded section */
|
||||||
U64 const pledgedSrcSize = job->firstJob ? job->fullFrameSize : job->src.size;
|
U64 const pledgedSrcSize = job->firstJob ? job->fullFrameSize : job->src.size;
|
||||||
{ size_t const forceWindowError = ZSTD_CCtxParam_setParameter(&jobParams, ZSTD_c_forceMaxWindow, !job->firstJob);
|
{ size_t const forceWindowError = ZSTD_CCtxParams_setParameter(&jobParams, ZSTD_c_forceMaxWindow, !job->firstJob);
|
||||||
if (ZSTD_isError(forceWindowError)) JOB_ERROR(forceWindowError);
|
if (ZSTD_isError(forceWindowError)) JOB_ERROR(forceWindowError);
|
||||||
}
|
}
|
||||||
{ size_t const initError = ZSTD_compressBegin_advanced_internal(cctx,
|
{ size_t const initError = ZSTD_compressBegin_advanced_internal(cctx,
|
||||||
@ -864,7 +864,7 @@ static size_t ZSTDMT_expandJobsTable (ZSTDMT_CCtx* mtctx, U32 nbWorkers) {
|
|||||||
* Internal use only */
|
* Internal use only */
|
||||||
size_t ZSTDMT_CCtxParam_setNbWorkers(ZSTD_CCtx_params* params, unsigned nbWorkers)
|
size_t ZSTDMT_CCtxParam_setNbWorkers(ZSTD_CCtx_params* params, unsigned nbWorkers)
|
||||||
{
|
{
|
||||||
return ZSTD_CCtxParam_setParameter(params, ZSTD_c_nbWorkers, (int)nbWorkers);
|
return ZSTD_CCtxParams_setParameter(params, ZSTD_c_nbWorkers, (int)nbWorkers);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZSTDMT_CCtx* ZSTDMT_createCCtx_advanced(unsigned nbWorkers, ZSTD_customMem cMem)
|
ZSTDMT_CCtx* ZSTDMT_createCCtx_advanced(unsigned nbWorkers, ZSTD_customMem cMem)
|
||||||
@ -982,13 +982,13 @@ ZSTDMT_CCtxParam_setMTCtxParameter(ZSTD_CCtx_params* params,
|
|||||||
{
|
{
|
||||||
case ZSTDMT_p_jobSize :
|
case ZSTDMT_p_jobSize :
|
||||||
DEBUGLOG(4, "ZSTDMT_CCtxParam_setMTCtxParameter : set jobSize to %i", value);
|
DEBUGLOG(4, "ZSTDMT_CCtxParam_setMTCtxParameter : set jobSize to %i", value);
|
||||||
return ZSTD_CCtxParam_setParameter(params, ZSTD_c_jobSize, value);
|
return ZSTD_CCtxParams_setParameter(params, ZSTD_c_jobSize, value);
|
||||||
case ZSTDMT_p_overlapLog :
|
case ZSTDMT_p_overlapLog :
|
||||||
DEBUGLOG(4, "ZSTDMT_p_overlapLog : %i", value);
|
DEBUGLOG(4, "ZSTDMT_p_overlapLog : %i", value);
|
||||||
return ZSTD_CCtxParam_setParameter(params, ZSTD_c_overlapLog, value);
|
return ZSTD_CCtxParams_setParameter(params, ZSTD_c_overlapLog, value);
|
||||||
case ZSTDMT_p_rsyncable :
|
case ZSTDMT_p_rsyncable :
|
||||||
DEBUGLOG(4, "ZSTD_p_rsyncable : %i", value);
|
DEBUGLOG(4, "ZSTD_p_rsyncable : %i", value);
|
||||||
return ZSTD_CCtxParam_setParameter(params, ZSTD_c_rsyncable, value);
|
return ZSTD_CCtxParams_setParameter(params, ZSTD_c_rsyncable, value);
|
||||||
default :
|
default :
|
||||||
return ERROR(parameter_unsupported);
|
return ERROR(parameter_unsupported);
|
||||||
}
|
}
|
||||||
@ -1004,11 +1004,11 @@ size_t ZSTDMT_getMTCtxParameter(ZSTDMT_CCtx* mtctx, ZSTDMT_parameter parameter,
|
|||||||
{
|
{
|
||||||
switch (parameter) {
|
switch (parameter) {
|
||||||
case ZSTDMT_p_jobSize:
|
case ZSTDMT_p_jobSize:
|
||||||
return ZSTD_CCtxParam_getParameter(&mtctx->params, ZSTD_c_jobSize, value);
|
return ZSTD_CCtxParams_getParameter(&mtctx->params, ZSTD_c_jobSize, value);
|
||||||
case ZSTDMT_p_overlapLog:
|
case ZSTDMT_p_overlapLog:
|
||||||
return ZSTD_CCtxParam_getParameter(&mtctx->params, ZSTD_c_overlapLog, value);
|
return ZSTD_CCtxParams_getParameter(&mtctx->params, ZSTD_c_overlapLog, value);
|
||||||
case ZSTDMT_p_rsyncable:
|
case ZSTDMT_p_rsyncable:
|
||||||
return ZSTD_CCtxParam_getParameter(&mtctx->params, ZSTD_c_rsyncable, value);
|
return ZSTD_CCtxParams_getParameter(&mtctx->params, ZSTD_c_rsyncable, value);
|
||||||
default:
|
default:
|
||||||
return ERROR(parameter_unsupported);
|
return ERROR(parameter_unsupported);
|
||||||
}
|
}
|
||||||
|
20
lib/zstd.h
20
lib/zstd.h
@ -1121,7 +1121,7 @@ ZSTDLIB_API size_t ZSTD_frameHeaderSize(const void* src, size_t srcSize);
|
|||||||
* It will also consider src size to be arbitrarily "large", which is worst case.
|
* It will also consider src size to be arbitrarily "large", which is worst case.
|
||||||
* If srcSize is known to always be small, ZSTD_estimateCCtxSize_usingCParams() can provide a tighter estimation.
|
* If srcSize is known to always be small, ZSTD_estimateCCtxSize_usingCParams() can provide a tighter estimation.
|
||||||
* ZSTD_estimateCCtxSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.
|
* ZSTD_estimateCCtxSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.
|
||||||
* ZSTD_estimateCCtxSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParam_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_c_nbWorkers is >= 1.
|
* ZSTD_estimateCCtxSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParams_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_c_nbWorkers is >= 1.
|
||||||
* Note : CCtx size estimation is only correct for single-threaded compression. */
|
* Note : CCtx size estimation is only correct for single-threaded compression. */
|
||||||
ZSTDLIB_API size_t ZSTD_estimateCCtxSize(int compressionLevel);
|
ZSTDLIB_API size_t ZSTD_estimateCCtxSize(int compressionLevel);
|
||||||
ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams);
|
ZSTDLIB_API size_t ZSTD_estimateCCtxSize_usingCParams(ZSTD_compressionParameters cParams);
|
||||||
@ -1133,7 +1133,7 @@ ZSTDLIB_API size_t ZSTD_estimateDCtxSize(void);
|
|||||||
* It will also consider src size to be arbitrarily "large", which is worst case.
|
* It will also consider src size to be arbitrarily "large", which is worst case.
|
||||||
* If srcSize is known to always be small, ZSTD_estimateCStreamSize_usingCParams() can provide a tighter estimation.
|
* If srcSize is known to always be small, ZSTD_estimateCStreamSize_usingCParams() can provide a tighter estimation.
|
||||||
* ZSTD_estimateCStreamSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.
|
* ZSTD_estimateCStreamSize_usingCParams() can be used in tandem with ZSTD_getCParams() to create cParams from compressionLevel.
|
||||||
* ZSTD_estimateCStreamSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParam_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_c_nbWorkers is >= 1.
|
* ZSTD_estimateCStreamSize_usingCCtxParams() can be used in tandem with ZSTD_CCtxParams_setParameter(). Only single-threaded compression is supported. This function will return an error code if ZSTD_c_nbWorkers is >= 1.
|
||||||
* Note : CStream size estimation is only correct for single-threaded compression.
|
* Note : CStream size estimation is only correct for single-threaded compression.
|
||||||
* ZSTD_DStream memory budget depends on window Size.
|
* ZSTD_DStream memory budget depends on window Size.
|
||||||
* This information can be passed manually, using ZSTD_estimateDStreamSize,
|
* This information can be passed manually, using ZSTD_estimateDStreamSize,
|
||||||
@ -1346,10 +1346,10 @@ ZSTDLIB_API size_t ZSTD_CCtx_getParameter(ZSTD_CCtx* cctx, ZSTD_cParameter param
|
|||||||
/*! ZSTD_CCtx_params :
|
/*! ZSTD_CCtx_params :
|
||||||
* Quick howto :
|
* Quick howto :
|
||||||
* - ZSTD_createCCtxParams() : Create a ZSTD_CCtx_params structure
|
* - ZSTD_createCCtxParams() : Create a ZSTD_CCtx_params structure
|
||||||
* - ZSTD_CCtxParam_setParameter() : Push parameters one by one into
|
* - ZSTD_CCtxParams_setParameter() : Push parameters one by one into
|
||||||
* an existing ZSTD_CCtx_params structure.
|
* an existing ZSTD_CCtx_params structure.
|
||||||
* This is similar to
|
* This is similar to
|
||||||
* ZSTD_CCtx_setParameter().
|
* ZSTD_CCtx_setParameter().
|
||||||
* - ZSTD_CCtx_setParametersUsingCCtxParams() : Apply parameters to
|
* - ZSTD_CCtx_setParametersUsingCCtxParams() : Apply parameters to
|
||||||
* an existing CCtx.
|
* an existing CCtx.
|
||||||
* These parameters will be applied to
|
* These parameters will be applied to
|
||||||
@ -1380,20 +1380,20 @@ ZSTDLIB_API size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compre
|
|||||||
*/
|
*/
|
||||||
ZSTDLIB_API size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params);
|
ZSTDLIB_API size_t ZSTD_CCtxParams_init_advanced(ZSTD_CCtx_params* cctxParams, ZSTD_parameters params);
|
||||||
|
|
||||||
/*! ZSTD_CCtxParam_setParameter() :
|
/*! ZSTD_CCtxParams_setParameter() :
|
||||||
* Similar to ZSTD_CCtx_setParameter.
|
* Similar to ZSTD_CCtx_setParameter.
|
||||||
* Set one compression parameter, selected by enum ZSTD_cParameter.
|
* Set one compression parameter, selected by enum ZSTD_cParameter.
|
||||||
* Parameters must be applied to a ZSTD_CCtx using ZSTD_CCtx_setParametersUsingCCtxParams().
|
* Parameters must be applied to a ZSTD_CCtx using ZSTD_CCtx_setParametersUsingCCtxParams().
|
||||||
* @result : 0, or an error code (which can be tested with ZSTD_isError()).
|
* @result : 0, or an error code (which can be tested with ZSTD_isError()).
|
||||||
*/
|
*/
|
||||||
ZSTDLIB_API size_t ZSTD_CCtxParam_setParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, int value);
|
ZSTDLIB_API size_t ZSTD_CCtxParams_setParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, int value);
|
||||||
|
|
||||||
/*! ZSTD_CCtxParam_getParameter() :
|
/*! ZSTD_CCtxParams_getParameter() :
|
||||||
* Similar to ZSTD_CCtx_getParameter.
|
* Similar to ZSTD_CCtx_getParameter.
|
||||||
* Get the requested value of one compression parameter, selected by enum ZSTD_cParameter.
|
* Get the requested value of one compression parameter, selected by enum ZSTD_cParameter.
|
||||||
* @result : 0, or an error code (which can be tested with ZSTD_isError()).
|
* @result : 0, or an error code (which can be tested with ZSTD_isError()).
|
||||||
*/
|
*/
|
||||||
ZSTDLIB_API size_t ZSTD_CCtxParam_getParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, int* value);
|
ZSTDLIB_API size_t ZSTD_CCtxParams_getParameter(ZSTD_CCtx_params* params, ZSTD_cParameter param, int* value);
|
||||||
|
|
||||||
/*! ZSTD_CCtx_setParametersUsingCCtxParams() :
|
/*! ZSTD_CCtx_setParametersUsingCCtxParams() :
|
||||||
* Apply a set of ZSTD_CCtx_params to the compression context.
|
* Apply a set of ZSTD_CCtx_params to the compression context.
|
||||||
|
@ -849,22 +849,22 @@ static int basicUnitTests(U32 seed, double compressibility)
|
|||||||
{ ZSTD_CCtx_params* params = ZSTD_createCCtxParams();
|
{ ZSTD_CCtx_params* params = ZSTD_createCCtxParams();
|
||||||
int value;
|
int value;
|
||||||
/* Check that the overlap log and job size are unset. */
|
/* Check that the overlap log and job size are unset. */
|
||||||
CHECK( ZSTD_CCtxParam_getParameter(params, ZSTD_c_overlapLog, &value) );
|
CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_overlapLog, &value) );
|
||||||
CHECK_EQ(value, 0);
|
CHECK_EQ(value, 0);
|
||||||
CHECK( ZSTD_CCtxParam_getParameter(params, ZSTD_c_jobSize, &value) );
|
CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_jobSize, &value) );
|
||||||
CHECK_EQ(value, 0);
|
CHECK_EQ(value, 0);
|
||||||
/* Set and check the overlap log and job size. */
|
/* Set and check the overlap log and job size. */
|
||||||
CHECK( ZSTD_CCtxParam_setParameter(params, ZSTD_c_overlapLog, 5) );
|
CHECK( ZSTD_CCtxParams_setParameter(params, ZSTD_c_overlapLog, 5) );
|
||||||
CHECK( ZSTD_CCtxParam_setParameter(params, ZSTD_c_jobSize, 2 MB) );
|
CHECK( ZSTD_CCtxParams_setParameter(params, ZSTD_c_jobSize, 2 MB) );
|
||||||
CHECK( ZSTD_CCtxParam_getParameter(params, ZSTD_c_overlapLog, &value) );
|
CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_overlapLog, &value) );
|
||||||
CHECK_EQ(value, 5);
|
CHECK_EQ(value, 5);
|
||||||
CHECK( ZSTD_CCtxParam_getParameter(params, ZSTD_c_jobSize, &value) );
|
CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_jobSize, &value) );
|
||||||
CHECK_EQ(value, 2 MB);
|
CHECK_EQ(value, 2 MB);
|
||||||
/* Set the number of worksers and check the overlap log and job size. */
|
/* Set the number of worksers and check the overlap log and job size. */
|
||||||
CHECK( ZSTD_CCtxParam_setParameter(params, ZSTD_c_nbWorkers, 2) );
|
CHECK( ZSTD_CCtxParams_setParameter(params, ZSTD_c_nbWorkers, 2) );
|
||||||
CHECK( ZSTD_CCtxParam_getParameter(params, ZSTD_c_overlapLog, &value) );
|
CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_overlapLog, &value) );
|
||||||
CHECK_EQ(value, 5);
|
CHECK_EQ(value, 5);
|
||||||
CHECK( ZSTD_CCtxParam_getParameter(params, ZSTD_c_jobSize, &value) );
|
CHECK( ZSTD_CCtxParams_getParameter(params, ZSTD_c_jobSize, &value) );
|
||||||
CHECK_EQ(value, 2 MB);
|
CHECK_EQ(value, 2 MB);
|
||||||
ZSTD_freeCCtxParams(params);
|
ZSTD_freeCCtxParams(params);
|
||||||
|
|
||||||
|
@ -93,9 +93,9 @@ static size_t cctxParamRoundTripTest(void* resultBuff, size_t resultBuffCapacity
|
|||||||
int const cLevel = h32 % maxClevel;
|
int const cLevel = h32 % maxClevel;
|
||||||
|
|
||||||
/* Set parameters */
|
/* Set parameters */
|
||||||
CHECK_Z( ZSTD_CCtxParam_setParameter(cctxParams, ZSTD_c_compressionLevel, cLevel) );
|
CHECK_Z( ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_compressionLevel, cLevel) );
|
||||||
CHECK_Z( ZSTD_CCtxParam_setParameter(cctxParams, ZSTD_c_nbWorkers, 2) );
|
CHECK_Z( ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_nbWorkers, 2) );
|
||||||
CHECK_Z( ZSTD_CCtxParam_setParameter(cctxParams, ZSTD_c_overlapLog, 5) );
|
CHECK_Z( ZSTD_CCtxParams_setParameter(cctxParams, ZSTD_c_overlapLog, 5) );
|
||||||
|
|
||||||
|
|
||||||
/* Apply parameters */
|
/* Apply parameters */
|
||||||
|
@ -1703,7 +1703,7 @@ static size_t setCCtxParameter(ZSTD_CCtx* zc, ZSTD_CCtx_params* cctxParams,
|
|||||||
int useOpaqueAPI)
|
int useOpaqueAPI)
|
||||||
{
|
{
|
||||||
if (useOpaqueAPI) {
|
if (useOpaqueAPI) {
|
||||||
return ZSTD_CCtxParam_setParameter(cctxParams, param, value);
|
return ZSTD_CCtxParams_setParameter(cctxParams, param, value);
|
||||||
} else {
|
} else {
|
||||||
return ZSTD_CCtx_setParameter(zc, param, value);
|
return ZSTD_CCtx_setParameter(zc, param, value);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user