Minor fixes; remove formatting only changes
This commit is contained in:
parent
a6e20e1bd7
commit
ee65701720
@ -352,12 +352,10 @@ void ZSTD_invalidateRepCodes(ZSTD_CCtx* cctx);
|
|||||||
* expects params to be valid.
|
* expects params to be valid.
|
||||||
* must receive dict, or cdict, or none, but not both.
|
* must receive dict, or cdict, or none, but not both.
|
||||||
* @return : 0, or an error code */
|
* @return : 0, or an error code */
|
||||||
size_t ZSTD_initCStream_internal(
|
size_t ZSTD_initCStream_internal(ZSTD_CStream* zcs,
|
||||||
ZSTD_CStream* zcs,
|
|
||||||
const void* dict, size_t dictSize,
|
const void* dict, size_t dictSize,
|
||||||
const ZSTD_CDict* cdict,
|
const ZSTD_CDict* cdict,
|
||||||
ZSTD_CCtx_params params,
|
ZSTD_CCtx_params params, unsigned long long pledgedSrcSize);
|
||||||
unsigned long long pledgedSrcSize);
|
|
||||||
|
|
||||||
/*! ZSTD_compressStream_generic() :
|
/*! ZSTD_compressStream_generic() :
|
||||||
* Private use only. To be called from zstdmt_compress.c in single-thread mode. */
|
* Private use only. To be called from zstdmt_compress.c in single-thread mode. */
|
||||||
@ -370,14 +368,16 @@ size_t ZSTD_compressStream_generic(ZSTD_CStream* zcs,
|
|||||||
* as the name implies */
|
* as the name implies */
|
||||||
ZSTD_compressionParameters ZSTD_getCParamsFromCDict(const ZSTD_CDict* cdict);
|
ZSTD_compressionParameters ZSTD_getCParamsFromCDict(const ZSTD_CDict* cdict);
|
||||||
|
|
||||||
/* INTERNAL */
|
/* ZSTD_compressBegin_advanced_internal() :
|
||||||
|
* Private use only. To be called from zstdmt_compress.c. */
|
||||||
size_t ZSTD_compressBegin_advanced_internal(ZSTD_CCtx* cctx,
|
size_t ZSTD_compressBegin_advanced_internal(ZSTD_CCtx* cctx,
|
||||||
const void* dict, size_t dictSize,
|
const void* dict, size_t dictSize,
|
||||||
ZSTD_dictMode_e dictMode,
|
ZSTD_dictMode_e dictMode,
|
||||||
ZSTD_CCtx_params params,
|
ZSTD_CCtx_params params,
|
||||||
unsigned long long pledgedSrcSize);
|
unsigned long long pledgedSrcSize);
|
||||||
|
|
||||||
/* INTERNAL */
|
/* ZSTD_compress_advanced_internal() :
|
||||||
|
* Private use only. To be called from zstdmt_compress.c. */
|
||||||
size_t ZSTD_compress_advanced_internal(ZSTD_CCtx* cctx,
|
size_t ZSTD_compress_advanced_internal(ZSTD_CCtx* cctx,
|
||||||
void* dst, size_t dstCapacity,
|
void* dst, size_t dstCapacity,
|
||||||
const void* src, size_t srcSize,
|
const void* src, size_t srcSize,
|
||||||
|
@ -516,8 +516,7 @@ size_t ZSTD_CCtx_loadDictionary_advanced(
|
|||||||
ZSTD_getCParamsFromCCtxParams(cctx->requestedParams, 0, dictSize);
|
ZSTD_getCParamsFromCCtxParams(cctx->requestedParams, 0, dictSize);
|
||||||
cctx->cdictLocal = ZSTD_createCDict_advanced(
|
cctx->cdictLocal = ZSTD_createCDict_advanced(
|
||||||
dict, dictSize,
|
dict, dictSize,
|
||||||
dictLoadMethod,
|
dictLoadMethod, dictMode,
|
||||||
dictMode,
|
|
||||||
cParams, cctx->customMem);
|
cParams, cctx->customMem);
|
||||||
cctx->cdict = cctx->cdictLocal;
|
cctx->cdict = cctx->cdictLocal;
|
||||||
if (cctx->cdictLocal == NULL)
|
if (cctx->cdictLocal == NULL)
|
||||||
@ -564,7 +563,6 @@ size_t ZSTD_CCtx_refPrefix_advanced(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void ZSTD_startNewCompression(ZSTD_CCtx* cctx)
|
static void ZSTD_startNewCompression(ZSTD_CCtx* cctx)
|
||||||
{
|
{
|
||||||
cctx->streamStage = zcss_init;
|
cctx->streamStage = zcss_init;
|
||||||
@ -785,7 +783,7 @@ static size_t ZSTD_resetCCtx_internal(ZSTD_CCtx* zc,
|
|||||||
|
|
||||||
if (crp == ZSTDcrp_continue) {
|
if (crp == ZSTDcrp_continue) {
|
||||||
if (ZSTD_equivalentParams(params, zc->appliedParams)) {
|
if (ZSTD_equivalentParams(params, zc->appliedParams)) {
|
||||||
DEBUGLOG(5, "ZSTD_equivalentCParams()==1");
|
DEBUGLOG(5, "ZSTD_equivalentParams()==1");
|
||||||
zc->entropy->hufCTable_repeatMode = HUF_repeat_none;
|
zc->entropy->hufCTable_repeatMode = HUF_repeat_none;
|
||||||
zc->entropy->offcode_repeatMode = FSE_repeat_none;
|
zc->entropy->offcode_repeatMode = FSE_repeat_none;
|
||||||
zc->entropy->matchlength_repeatMode = FSE_repeat_none;
|
zc->entropy->matchlength_repeatMode = FSE_repeat_none;
|
||||||
@ -3582,7 +3580,7 @@ size_t ZSTD_estimateCDictSize_advanced(
|
|||||||
size_t ZSTD_estimateCDictSize(size_t dictSize, int compressionLevel)
|
size_t ZSTD_estimateCDictSize(size_t dictSize, int compressionLevel)
|
||||||
{
|
{
|
||||||
ZSTD_compressionParameters const cParams = ZSTD_getCParams(compressionLevel, 0, dictSize);
|
ZSTD_compressionParameters const cParams = ZSTD_getCParams(compressionLevel, 0, dictSize);
|
||||||
return ZSTD_estimateCDictSize_advanced(dictSize, cParams, 0);
|
return ZSTD_estimateCDictSize_advanced(dictSize, cParams, ZSTD_dlm_byCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ZSTD_sizeof_CDict(const ZSTD_CDict* cdict)
|
size_t ZSTD_sizeof_CDict(const ZSTD_CDict* cdict)
|
||||||
@ -3624,6 +3622,7 @@ static size_t ZSTD_initCDict_internal(
|
|||||||
cctxParams, ZSTD_CONTENTSIZE_UNKNOWN,
|
cctxParams, ZSTD_CONTENTSIZE_UNKNOWN,
|
||||||
ZSTDb_not_buffered) );
|
ZSTDb_not_buffered) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3637,6 +3636,7 @@ ZSTD_CDict* ZSTD_createCDict_advanced(const void* dictBuffer, size_t dictSize,
|
|||||||
|
|
||||||
{ ZSTD_CDict* const cdict = (ZSTD_CDict*)ZSTD_malloc(sizeof(ZSTD_CDict), customMem);
|
{ ZSTD_CDict* const cdict = (ZSTD_CDict*)ZSTD_malloc(sizeof(ZSTD_CDict), customMem);
|
||||||
ZSTD_CCtx* const cctx = ZSTD_createCCtx_advanced(customMem);
|
ZSTD_CCtx* const cctx = ZSTD_createCCtx_advanced(customMem);
|
||||||
|
|
||||||
if (!cdict || !cctx) {
|
if (!cdict || !cctx) {
|
||||||
ZSTD_free(cdict, customMem);
|
ZSTD_free(cdict, customMem);
|
||||||
ZSTD_freeCCtx(cctx);
|
ZSTD_freeCCtx(cctx);
|
||||||
@ -3650,6 +3650,7 @@ ZSTD_CDict* ZSTD_createCDict_advanced(const void* dictBuffer, size_t dictSize,
|
|||||||
ZSTD_freeCDict(cdict);
|
ZSTD_freeCDict(cdict);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return cdict;
|
return cdict;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3822,8 +3823,7 @@ size_t ZSTD_CStreamOutSize(void)
|
|||||||
return ZSTD_compressBound(ZSTD_BLOCKSIZE_MAX) + ZSTD_blockHeaderSize + 4 /* 32-bits hash */ ;
|
return ZSTD_compressBound(ZSTD_BLOCKSIZE_MAX) + ZSTD_blockHeaderSize + 4 /* 32-bits hash */ ;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t ZSTD_resetCStream_internal(
|
static size_t ZSTD_resetCStream_internal(ZSTD_CStream* zcs,
|
||||||
ZSTD_CStream* zcs,
|
|
||||||
const void* dict, size_t dictSize, ZSTD_dictMode_e dictMode,
|
const void* dict, size_t dictSize, ZSTD_dictMode_e dictMode,
|
||||||
const ZSTD_CDict* cdict,
|
const ZSTD_CDict* cdict,
|
||||||
const ZSTD_CCtx_params params, unsigned long long pledgedSrcSize)
|
const ZSTD_CCtx_params params, unsigned long long pledgedSrcSize)
|
||||||
@ -3862,8 +3862,7 @@ size_t ZSTD_resetCStream(ZSTD_CStream* zcs, unsigned long long pledgedSrcSize)
|
|||||||
* Assumption 1 : params are valid
|
* Assumption 1 : params are valid
|
||||||
* Assumption 2 : either dict, or cdict, is defined, not both */
|
* Assumption 2 : either dict, or cdict, is defined, not both */
|
||||||
size_t ZSTD_initCStream_internal(ZSTD_CStream* zcs,
|
size_t ZSTD_initCStream_internal(ZSTD_CStream* zcs,
|
||||||
const void* dict, size_t dictSize,
|
const void* dict, size_t dictSize, const ZSTD_CDict* cdict,
|
||||||
const ZSTD_CDict* cdict,
|
|
||||||
ZSTD_CCtx_params params, unsigned long long pledgedSrcSize)
|
ZSTD_CCtx_params params, unsigned long long pledgedSrcSize)
|
||||||
{
|
{
|
||||||
assert(!ZSTD_isError(ZSTD_checkCParams(params.cParams)));
|
assert(!ZSTD_isError(ZSTD_checkCParams(params.cParams)));
|
||||||
@ -3876,8 +3875,7 @@ size_t ZSTD_initCStream_internal(ZSTD_CStream* zcs,
|
|||||||
return ERROR(memory_allocation);
|
return ERROR(memory_allocation);
|
||||||
}
|
}
|
||||||
ZSTD_freeCDict(zcs->cdictLocal);
|
ZSTD_freeCDict(zcs->cdictLocal);
|
||||||
zcs->cdictLocal = ZSTD_createCDict_advanced(
|
zcs->cdictLocal = ZSTD_createCDict_advanced(dict, dictSize,
|
||||||
dict, dictSize,
|
|
||||||
ZSTD_dlm_byCopy, ZSTD_dm_auto,
|
ZSTD_dlm_byCopy, ZSTD_dm_auto,
|
||||||
params.cParams, zcs->customMem);
|
params.cParams, zcs->customMem);
|
||||||
zcs->cdict = zcs->cdictLocal;
|
zcs->cdict = zcs->cdictLocal;
|
||||||
@ -4156,7 +4154,6 @@ size_t ZSTD_compress_generic (ZSTD_CCtx* cctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEBUGLOG(4, "call ZSTDMT_initCStream_internal as nbThreads=%u", params.nbThreads);
|
DEBUGLOG(4, "call ZSTDMT_initCStream_internal as nbThreads=%u", params.nbThreads);
|
||||||
|
|
||||||
CHECK_F( ZSTDMT_initCStream_internal(
|
CHECK_F( ZSTDMT_initCStream_internal(
|
||||||
cctx->mtctx, prefixDict.dict, prefixDict.dictSize,
|
cctx->mtctx, prefixDict.dict, prefixDict.dictSize,
|
||||||
cctx->cdict, params, cctx->pledgedSrcSizePlusOne-1) );
|
cctx->cdict, params, cctx->pledgedSrcSizePlusOne-1) );
|
||||||
|
@ -813,7 +813,7 @@ static int basicUnitTests(U32 seed, double compressibility)
|
|||||||
DISPLAYLEVEL(4, "test%3i : Loading rawContent starting with dict header w/ ZSTD_dm_auto should fail", testNb++);
|
DISPLAYLEVEL(4, "test%3i : Loading rawContent starting with dict header w/ ZSTD_dm_auto should fail", testNb++);
|
||||||
{
|
{
|
||||||
size_t ret;
|
size_t ret;
|
||||||
MEM_writeLE32(dictBuffer+2, ZSTD_MAGIC_DICTIONARY);
|
MEM_writeLE32((char*)dictBuffer+2, ZSTD_MAGIC_DICTIONARY);
|
||||||
ret = ZSTD_CCtx_loadDictionary_advanced(
|
ret = ZSTD_CCtx_loadDictionary_advanced(
|
||||||
cctx, (const char*)dictBuffer+2, dictSize-2, ZSTD_dlm_byRef, ZSTD_dm_auto);
|
cctx, (const char*)dictBuffer+2, dictSize-2, ZSTD_dlm_byRef, ZSTD_dm_auto);
|
||||||
if (!ZSTD_isError(ret)) goto _output_error;
|
if (!ZSTD_isError(ret)) goto _output_error;
|
||||||
@ -823,7 +823,7 @@ static int basicUnitTests(U32 seed, double compressibility)
|
|||||||
DISPLAYLEVEL(4, "test%3i : Loading rawContent starting with dict header w/ ZSTD_dm_rawContent should pass", testNb++);
|
DISPLAYLEVEL(4, "test%3i : Loading rawContent starting with dict header w/ ZSTD_dm_rawContent should pass", testNb++);
|
||||||
{
|
{
|
||||||
size_t ret;
|
size_t ret;
|
||||||
MEM_writeLE32(dictBuffer+2, ZSTD_MAGIC_DICTIONARY);
|
MEM_writeLE32((char*)dictBuffer+2, ZSTD_MAGIC_DICTIONARY);
|
||||||
ret = ZSTD_CCtx_loadDictionary_advanced(
|
ret = ZSTD_CCtx_loadDictionary_advanced(
|
||||||
cctx, (const char*)dictBuffer+2, dictSize-2, ZSTD_dlm_byRef, ZSTD_dm_rawContent);
|
cctx, (const char*)dictBuffer+2, dictSize-2, ZSTD_dlm_byRef, ZSTD_dm_rawContent);
|
||||||
if (ZSTD_isError(ret)) goto _output_error;
|
if (ZSTD_isError(ret)) goto _output_error;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user