fullbench: tests for ZBUFF_createCCtx_advanced and ZBUFF_createDCtx_advanced
This commit is contained in:
@@ -2052,8 +2052,7 @@ static size_t ZSTD_compress_generic (ZSTD_CCtx* zc,
|
||||
BYTE* const ostart = (BYTE*)dst;
|
||||
BYTE* op = ostart;
|
||||
const U32 maxDist = 1 << zc->params.cParams.windowLog;
|
||||
ZSTD_stats_t* stats = (ZSTD_stats_t*) zc->customAlloc(sizeof(ZSTD_stats_t));
|
||||
if (!stats) return ERROR(memory_allocation);
|
||||
ZSTD_stats_t* stats = ZSTD_statsAlloc();
|
||||
zc->seqStore.stats = stats;
|
||||
ZSTD_statsInit(stats);
|
||||
|
||||
@@ -2061,7 +2060,7 @@ static size_t ZSTD_compress_generic (ZSTD_CCtx* zc,
|
||||
size_t cSize;
|
||||
ZSTD_statsResetFreqs(stats);
|
||||
|
||||
if (dstCapacity < ZSTD_blockHeaderSize + MIN_CBLOCK_SIZE) { zc->customFree(stats); return ERROR(dstSize_tooSmall); } /* not enough space to store compressed block */
|
||||
if (dstCapacity < ZSTD_blockHeaderSize + MIN_CBLOCK_SIZE) { ZSTD_statsFree(stats); return ERROR(dstSize_tooSmall); } /* not enough space to store compressed block */
|
||||
if (remaining < blockSize) blockSize = remaining;
|
||||
|
||||
if ((U32)(ip+blockSize - zc->base) > zc->loadedDictEnd + maxDist) {
|
||||
@@ -2072,11 +2071,11 @@ static size_t ZSTD_compress_generic (ZSTD_CCtx* zc,
|
||||
}
|
||||
|
||||
cSize = ZSTD_compressBlock_internal(zc, op+ZSTD_blockHeaderSize, dstCapacity-ZSTD_blockHeaderSize, ip, blockSize);
|
||||
if (ZSTD_isError(cSize)) { zc->customFree(stats); return cSize; }
|
||||
if (ZSTD_isError(cSize)) { ZSTD_statsFree(stats); return cSize; }
|
||||
|
||||
if (cSize == 0) { /* block is not compressible */
|
||||
cSize = ZSTD_noCompressBlock(op, dstCapacity, ip, blockSize);
|
||||
if (ZSTD_isError(cSize)) { zc->customFree(stats); return cSize; }
|
||||
if (ZSTD_isError(cSize)) { ZSTD_statsFree(stats); return cSize; }
|
||||
} else {
|
||||
op[0] = (BYTE)(cSize>>16);
|
||||
op[1] = (BYTE)(cSize>>8);
|
||||
@@ -2092,7 +2091,7 @@ static size_t ZSTD_compress_generic (ZSTD_CCtx* zc,
|
||||
}
|
||||
|
||||
ZSTD_statsPrint(stats, zc->params.cParams.searchLength);
|
||||
zc->customFree(stats);
|
||||
ZSTD_statsFree(stats);
|
||||
return op-ostart;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user