MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ZSTD_checkOutBuffer

Function ZSTD_checkOutBuffer

freebsd/contrib/openzfs/module/zstd/lib/zstd.c:26043–26058  ·  view source on GitHub ↗

Checks that the output buffer hasn't changed if ZSTD_obm_stable is used. */

Source from the content-addressed store, hash-verified

26041
26042/* Checks that the output buffer hasn't changed if ZSTD_obm_stable is used. */
26043static size_t ZSTD_checkOutBuffer(ZSTD_DStream const* zds, ZSTD_outBuffer const* output)
26044{
26045 ZSTD_outBuffer const expect = zds->expectedOutBuffer;
26046 /* No requirement when ZSTD_obm_stable is not enabled. */
26047 if (zds->outBufferMode != ZSTD_obm_stable)
26048 return 0;
26049 /* Any buffer is allowed in zdss_init, this must be the same for every other call until
26050 * the context is reset.
26051 */
26052 if (zds->streamStage == zdss_init)
26053 return 0;
26054 /* The buffer must match our expectation exactly. */
26055 if (expect.dst == output->dst && expect.pos == output->pos && expect.size == output->size)
26056 return 0;
26057 RETURN_ERROR(dstBuffer_wrong, "ZSTD_obm_stable enabled but output differs!");
26058}
26059
26060/* Calls ZSTD_decompressContinue() with the right parameters for ZSTD_decompressStream()
26061 * and updates the stage and the output buffer state. This call is extracted so it can be

Callers 1

ZSTD_decompressStreamFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected