fixed: tree not updated after finding very long rep matches
This commit is contained in:
@@ -2205,8 +2205,13 @@ static ZSTD_blockCompressor ZSTD_selectBlockCompressor(ZSTD_strategy strat, int
|
|||||||
static size_t ZSTD_compressBlock_internal(ZSTD_CCtx* zc, void* dst, size_t dstCapacity, const void* src, size_t srcSize)
|
static size_t ZSTD_compressBlock_internal(ZSTD_CCtx* zc, void* dst, size_t dstCapacity, const void* src, size_t srcSize)
|
||||||
{
|
{
|
||||||
ZSTD_blockCompressor const blockCompressor = ZSTD_selectBlockCompressor(zc->params.cParams.strategy, zc->lowLimit < zc->dictLimit);
|
ZSTD_blockCompressor const blockCompressor = ZSTD_selectBlockCompressor(zc->params.cParams.strategy, zc->lowLimit < zc->dictLimit);
|
||||||
|
const BYTE* const base = zc->base;
|
||||||
|
const BYTE* const istart = (const BYTE*)src;
|
||||||
|
const U32 current = (U32)(istart-base);
|
||||||
if (srcSize < MIN_CBLOCK_SIZE+ZSTD_blockHeaderSize+1) return 0; /* don't even attempt compression below a certain srcSize */
|
if (srcSize < MIN_CBLOCK_SIZE+ZSTD_blockHeaderSize+1) return 0; /* don't even attempt compression below a certain srcSize */
|
||||||
ZSTD_resetSeqStore(&(zc->seqStore));
|
ZSTD_resetSeqStore(&(zc->seqStore));
|
||||||
|
if (current > zc->nextToUpdate + 384)
|
||||||
|
zc->nextToUpdate = current - MIN(192, (U32)(current - zc->nextToUpdate - 384)); /* update tree not updated after finding very long rep matches */
|
||||||
blockCompressor(zc, src, srcSize);
|
blockCompressor(zc, src, srcSize);
|
||||||
return ZSTD_compressSequences(zc, dst, dstCapacity, srcSize);
|
return ZSTD_compressSequences(zc, dst, dstCapacity, srcSize);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user