Stop using deprecated reset?Stream functions
These are replaced by the corresponding context resets. When converting resetCStream, CCtx_setPledgedSrcSize isn't called if the source size is "unknown". This helps reduce the reliance on "static only" symbols, as well as reducing the use of deprecated functions. Signed-off-by: Stephen Kitt <steve@sk2.org>
This commit is contained in:
parent
f7cffb5d9d
commit
adb54293ab
@ -274,7 +274,7 @@ static void compress(
|
||||
return;
|
||||
}
|
||||
{
|
||||
auto err = ZSTD_resetCStream(ctx.get(), 0);
|
||||
auto err = ZSTD_CCtx_reset(ctx.get(), ZSTD_reset_session_only);
|
||||
if (!errorHolder.check(!ZSTD_isError(err), ZSTD_getErrorName(err))) {
|
||||
return;
|
||||
}
|
||||
@ -432,7 +432,7 @@ static void decompress(
|
||||
return;
|
||||
}
|
||||
{
|
||||
auto err = ZSTD_resetDStream(ctx.get());
|
||||
auto err = ZSTD_DCtx_reset(ctx.get(), ZSTD_reset_session_only);
|
||||
if (!errorHolder.check(!ZSTD_isError(err), ZSTD_getErrorName(err))) {
|
||||
return;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ size_t ZSTD_seekable_endFrame(ZSTD_seekable_CStream* zcs, ZSTD_outBuffer* output
|
||||
zcs->frameCSize = 0;
|
||||
zcs->frameDSize = 0;
|
||||
|
||||
ZSTD_resetCStream(zcs->cstream, 0);
|
||||
ZSTD_CCtx_reset(zcs->cstream, ZSTD_reset_session_only);
|
||||
if (zcs->framelog.checksumFlag)
|
||||
XXH64_reset(&zcs->xxhState, 0);
|
||||
|
||||
|
@ -394,7 +394,7 @@ size_t ZSTD_seekable_decompress(ZSTD_seekable* zs, void* dst, size_t len, unsign
|
||||
SEEK_SET));
|
||||
zs->in = (ZSTD_inBuffer){zs->inBuff, 0, 0};
|
||||
XXH64_reset(&zs->xxhState, 0);
|
||||
ZSTD_resetDStream(zs->dstream);
|
||||
ZSTD_DCtx_reset(zs->dstream, ZSTD_reset_session_only);
|
||||
}
|
||||
|
||||
while (zs->decompressedOffset < offset + len) {
|
||||
|
@ -2109,7 +2109,7 @@ FIO_decompressZstdFrame(FIO_ctx_t* const fCtx, dRess_t* ress, FILE* finput,
|
||||
if (srcFileLength>20) srcFileName += srcFileLength-20;
|
||||
}
|
||||
|
||||
ZSTD_resetDStream(ress->dctx);
|
||||
ZSTD_DCtx_reset(ress->dctx, ZSTD_reset_session_only);
|
||||
|
||||
/* Header loading : ensures ZSTD_getFrameHeader() will succeed */
|
||||
{ size_t const toDecode = ZSTD_FRAMEHEADERSIZE_MAX;
|
||||
|
@ -270,8 +270,10 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize,
|
||||
do {
|
||||
U32 blockNb;
|
||||
for (blockNb=0; blockNb<nbBlocks; blockNb++) {
|
||||
rSize = ZSTD_resetCStream(zbc, blockTable[blockNb].srcSize);
|
||||
if (ZSTD_isError(rSize)) EXM_THROW(1, "ZSTD_resetCStream() failed : %s", ZSTD_getErrorName(rSize));
|
||||
rSize = ZSTD_CCtx_reset(zbc, ZSTD_reset_session_only);
|
||||
if (ZSTD_isError(rSize)) EXM_THROW(1, "ZSTD_CCtx_reset() failed : %s", ZSTD_getErrorName(rSize));
|
||||
rSize = ZSTD_CCtx_setPledgedSrcSize(zbc, blockTable[blockNb].srcSize);
|
||||
if (ZSTD_isError(rSize)) EXM_THROW(1, "ZSTD_CCtx_setPledgedSrcSize() failed : %s", ZSTD_getErrorName(rSize));
|
||||
inBuffer.src = blockTable[blockNb].srcPtr;
|
||||
inBuffer.size = blockTable[blockNb].srcSize;
|
||||
inBuffer.pos = 0;
|
||||
@ -418,8 +420,8 @@ static int BMK_benchMem(z_const void* srcBuffer, size_t srcSize,
|
||||
do {
|
||||
U32 blockNb;
|
||||
for (blockNb=0; blockNb<nbBlocks; blockNb++) {
|
||||
rSize = ZSTD_resetDStream(zbd);
|
||||
if (ZSTD_isError(rSize)) EXM_THROW(1, "ZSTD_resetDStream() failed : %s", ZSTD_getErrorName(rSize));
|
||||
rSize = ZSTD_DCtx_reset(zbd, ZSTD_reset_session_only);
|
||||
if (ZSTD_isError(rSize)) EXM_THROW(1, "ZSTD_DCtx_reset() failed : %s", ZSTD_getErrorName(rSize));
|
||||
inBuffer.src = blockTable[blockNb].cPtr;
|
||||
inBuffer.size = blockTable[blockNb].cSize;
|
||||
inBuffer.pos = 0;
|
||||
|
@ -372,9 +372,15 @@ ZEXTERN int ZEXPORT z_deflate OF((z_streamp strm, int flush))
|
||||
} else {
|
||||
if (zwc->totalInBytes == 0) {
|
||||
if (zwc->comprState == ZWRAP_useReset) {
|
||||
size_t const resetErr = ZSTD_resetCStream(zwc->zbc, (flush == Z_FINISH) ? strm->avail_in : zwc->pledgedSrcSize);
|
||||
size_t resetErr = ZSTD_CCtx_reset(zwc->zbc, ZSTD_reset_session_only);
|
||||
if (ZSTD_isError(resetErr)) {
|
||||
LOG_WRAPPERC("ERROR: ZSTD_resetCStream errorCode=%s\n",
|
||||
LOG_WRAPPERC("ERROR: ZSTD_CCtx_reset errorCode=%s\n",
|
||||
ZSTD_getErrorName(resetErr));
|
||||
return ZWRAPC_finishWithError(zwc, strm, 0);
|
||||
}
|
||||
resetErr = ZSTD_CCtx_setPledgedSrcSize(zwc->zbc, (flush == Z_FINISH) ? strm->avail_in : zwc->pledgedSrcSize);
|
||||
if (ZSTD_isError(resetErr)) {
|
||||
LOG_WRAPPERC("ERROR: ZSTD_CCtx_setPledgedSrcSize errorCode=%s\n",
|
||||
ZSTD_getErrorName(resetErr));
|
||||
return ZWRAPC_finishWithError(zwc, strm, 0);
|
||||
}
|
||||
@ -829,7 +835,7 @@ ZEXTERN int ZEXPORT z_inflate OF((z_streamp strm, int flush))
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
size_t const resetErr = ZSTD_resetDStream(zwd->zbd);
|
||||
size_t const resetErr = ZSTD_DCtx_reset(zwd->zbd, ZSTD_reset_session_only);
|
||||
if (ZSTD_isError(resetErr)) goto error;
|
||||
}
|
||||
} else {
|
||||
@ -849,7 +855,7 @@ ZEXTERN int ZEXPORT z_inflate OF((z_streamp strm, int flush))
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
size_t const resetErr = ZSTD_resetDStream(zwd->zbd);
|
||||
size_t const resetErr = ZSTD_DCtx_reset(zwd->zbd, ZSTD_reset_session_only);
|
||||
if (ZSTD_isError(resetErr)) goto error;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user