Use cctxParam version of createCDict internally
This commit is contained in:
parent
91b30dbe84
commit
502031ca10
@ -360,6 +360,11 @@ size_t ZSTD_initCStream_internal_opaque(
|
||||
ZSTD_CCtx_params params,
|
||||
unsigned long long pledgedSrcSize);
|
||||
|
||||
/* INTERNAL */
|
||||
ZSTD_CDict* ZSTD_createCDict_advanced_opaque(
|
||||
const void* dictBuffer, size_t dictSize,
|
||||
ZSTD_CCtx_params params, ZSTD_customMem customMem);
|
||||
|
||||
/*! ZSTD_compressStream_generic() :
|
||||
* Private use only. To be called from zstdmt_compress.c in single-thread mode. */
|
||||
size_t ZSTD_compressStream_generic(ZSTD_CStream* zcs,
|
||||
|
@ -3698,7 +3698,8 @@ static size_t ZSTD_initCDict_internal(
|
||||
}
|
||||
#endif
|
||||
|
||||
static ZSTD_CDict* ZSTD_createCDict_advanced_opaque(
|
||||
/* Internal only */
|
||||
ZSTD_CDict* ZSTD_createCDict_advanced_opaque(
|
||||
const void* dictBuffer, size_t dictSize,
|
||||
ZSTD_CCtx_params params, ZSTD_customMem customMem)
|
||||
{
|
||||
@ -3715,6 +3716,7 @@ static ZSTD_CDict* ZSTD_createCDict_advanced_opaque(
|
||||
}
|
||||
cdict->refContext = cctx;
|
||||
|
||||
/* TODO: What should be zero? */
|
||||
if (ZSTD_isError( ZSTD_initCDict_internal_opaque(
|
||||
cdict,
|
||||
dictBuffer, dictSize,
|
||||
@ -3992,10 +3994,10 @@ size_t ZSTD_initCStream_internal_opaque(
|
||||
return ERROR(memory_allocation);
|
||||
}
|
||||
ZSTD_freeCDict(zcs->cdictLocal);
|
||||
zcs->cdictLocal = ZSTD_createCDict_advanced(dict, dictSize,
|
||||
params.dictContentByRef,
|
||||
params.dictMode,
|
||||
params.cParams, zcs->customMem);
|
||||
/* TODO opaque version: what needs to be zero? */
|
||||
zcs->cdictLocal = ZSTD_createCDict_advanced_opaque(
|
||||
dict, dictSize,
|
||||
params, zcs->customMem);
|
||||
zcs->cdict = zcs->cdictLocal;
|
||||
if (zcs->cdictLocal == NULL) return ERROR(memory_allocation);
|
||||
} else {
|
||||
|
@ -195,6 +195,7 @@ static void ZSTDMT_zeroCCtxParams(ZSTD_CCtx_params* params)
|
||||
{
|
||||
params->forceWindow = 0;
|
||||
params->dictMode = (ZSTD_dictMode_e)(0);
|
||||
params->dictContentByRef = 0;
|
||||
params->nbThreads = 0;
|
||||
params->jobSize = 0;
|
||||
params->overlapSizeLog = 0;
|
||||
@ -719,13 +720,9 @@ size_t ZSTDMT_initCStream_internal_opaque(
|
||||
const ZSTD_CDict* cdict, ZSTD_CCtx_params cctxParams,
|
||||
unsigned long long pledgedSrcSize)
|
||||
{
|
||||
ZSTD_parameters params;
|
||||
params.cParams = cctxParams.cParams;
|
||||
params.fParams = cctxParams.fParams;
|
||||
|
||||
DEBUGLOG(4, "ZSTDMT_initCStream_internal");
|
||||
/* params are supposed to be fully validated at this point */
|
||||
assert(!ZSTD_isError(ZSTD_checkCParams(params.cParams)));
|
||||
assert(!ZSTD_isError(ZSTD_checkCParams(cctxParams.cParams)));
|
||||
assert(!((dict) && (cdict))); /* either dict or cdict, not both */
|
||||
|
||||
/* TODO: Set stuff to 0 to preserve old semantics. */
|
||||
@ -749,10 +746,11 @@ size_t ZSTDMT_initCStream_internal_opaque(
|
||||
if (dict) {
|
||||
DEBUGLOG(4,"cdictLocal: %08X", (U32)(size_t)zcs->cdictLocal);
|
||||
ZSTD_freeCDict(zcs->cdictLocal);
|
||||
/* TODO: This will need a cctxParam version? */
|
||||
zcs->cdictLocal = ZSTD_createCDict_advanced(dict, dictSize,
|
||||
0 /* byRef */, ZSTD_dm_auto, /* note : a loadPrefix becomes an internal CDict */
|
||||
params.cParams, zcs->cMem);
|
||||
/* TODO: cctxParam version? Is this correct?
|
||||
* by reference should be zero, mode should be ZSTD_dm_auto */
|
||||
zcs->cdictLocal = ZSTD_createCDict_advanced_opaque(
|
||||
dict, dictSize,
|
||||
cctxParams, zcs->cMem);
|
||||
zcs->cdict = zcs->cdictLocal;
|
||||
if (zcs->cdictLocal == NULL) return ERROR(memory_allocation);
|
||||
} else {
|
||||
@ -777,7 +775,7 @@ size_t ZSTDMT_initCStream_internal_opaque(
|
||||
zcs->nextJobID = 0;
|
||||
zcs->frameEnded = 0;
|
||||
zcs->allJobsCompleted = 0;
|
||||
if (params.fParams.checksumFlag) XXH64_reset(&zcs->xxhState, 0);
|
||||
if (cctxParams.fParams.checksumFlag) XXH64_reset(&zcs->xxhState, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user