fixed issue with small dictionary
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
configurationVersion: 1
|
||||||
|
|
||||||
|
filters:
|
||||||
|
# third-party embedded
|
||||||
|
- filePath: lib/dictBuilder/divsufsort.c
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
v0.7.4
|
v0.7.4
|
||||||
|
Added : new examples
|
||||||
|
Fixed : segfault when using small dictionaries
|
||||||
Modified : default compression level for CLI is 3
|
Modified : default compression level for CLI is 3
|
||||||
|
|
||||||
|
|
||||||
v0.7.3
|
v0.7.3
|
||||||
New : compression format specification
|
New : compression format specification
|
||||||
New : `--` separator, stating that all following arguments are file names. Suggested by Chip Turner.
|
New : `--` separator, stating that all following arguments are file names. Suggested by Chip Turner.
|
||||||
|
|||||||
@@ -273,9 +273,10 @@ size_t ZSTD_estimateCCtxSize(ZSTD_compressionParameters cParams)
|
|||||||
/*! ZSTD_resetCCtx_advanced() :
|
/*! ZSTD_resetCCtx_advanced() :
|
||||||
note : 'params' is expected to be validated */
|
note : 'params' is expected to be validated */
|
||||||
static size_t ZSTD_resetCCtx_advanced (ZSTD_CCtx* zc,
|
static size_t ZSTD_resetCCtx_advanced (ZSTD_CCtx* zc,
|
||||||
ZSTD_parameters params, U64 frameContentSize, U32 reset)
|
ZSTD_parameters params, U64 frameContentSize,
|
||||||
|
U32 reset, U32 fullBlockSize)
|
||||||
{ /* note : params considered validated here */
|
{ /* note : params considered validated here */
|
||||||
const size_t blockSize = MIN(ZSTD_BLOCKSIZE_MAX, (size_t)1 << params.cParams.windowLog);
|
const size_t blockSize = fullBlockSize ? ZSTD_BLOCKSIZE_MAX : MIN(ZSTD_BLOCKSIZE_MAX, (size_t)1 << params.cParams.windowLog);
|
||||||
const U32 divider = (params.cParams.searchLength==3) ? 3 : 4;
|
const U32 divider = (params.cParams.searchLength==3) ? 3 : 4;
|
||||||
const size_t maxNbSeq = blockSize / divider;
|
const size_t maxNbSeq = blockSize / divider;
|
||||||
const size_t tokenSpace = blockSize + 11*maxNbSeq;
|
const size_t tokenSpace = blockSize + 11*maxNbSeq;
|
||||||
@@ -357,7 +358,7 @@ size_t ZSTD_copyCCtx(ZSTD_CCtx* dstCCtx, const ZSTD_CCtx* srcCCtx)
|
|||||||
if (srcCCtx->stage!=1) return ERROR(stage_wrong);
|
if (srcCCtx->stage!=1) return ERROR(stage_wrong);
|
||||||
|
|
||||||
memcpy(&dstCCtx->customMem, &srcCCtx->customMem, sizeof(ZSTD_customMem));
|
memcpy(&dstCCtx->customMem, &srcCCtx->customMem, sizeof(ZSTD_customMem));
|
||||||
ZSTD_resetCCtx_advanced(dstCCtx, srcCCtx->params, srcCCtx->frameContentSize, 0);
|
ZSTD_resetCCtx_advanced(dstCCtx, srcCCtx->params, srcCCtx->frameContentSize, 0, 1);
|
||||||
dstCCtx->params.fParams.contentSizeFlag = 0; /* content size different from the one set during srcCCtx init */
|
dstCCtx->params.fParams.contentSizeFlag = 0; /* content size different from the one set during srcCCtx init */
|
||||||
|
|
||||||
/* copy tables */
|
/* copy tables */
|
||||||
@@ -2694,7 +2695,7 @@ static size_t ZSTD_compressBegin_internal(ZSTD_CCtx* zc,
|
|||||||
const void* dict, size_t dictSize,
|
const void* dict, size_t dictSize,
|
||||||
ZSTD_parameters params, U64 pledgedSrcSize)
|
ZSTD_parameters params, U64 pledgedSrcSize)
|
||||||
{
|
{
|
||||||
size_t const resetError = ZSTD_resetCCtx_advanced(zc, params, pledgedSrcSize, 1);
|
size_t const resetError = ZSTD_resetCCtx_advanced(zc, params, pledgedSrcSize, 1, 0);
|
||||||
if (ZSTD_isError(resetError)) return resetError;
|
if (ZSTD_isError(resetError)) return resetError;
|
||||||
|
|
||||||
return ZSTD_compress_insertDictionary(zc, dict, dictSize);
|
return ZSTD_compress_insertDictionary(zc, dict, dictSize);
|
||||||
|
|||||||
Reference in New Issue
Block a user