[contrib][linux] Make zstd_reset_cstream() functionally identical to ZSTD_resetCStream()

- As referenced by Nick Terrelln ~ the ZSTD maintainer in the linux kernel, making zstd_reset_cstream() functionally identical to ZSTD_resetCStream() would be the perfect way to fix the warning without touching any core functions or breaking other parts of the code.

Suggested-by: Nick Terrell <terrelln@fb.com>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
dev
Cyber Knight 2022-03-10 15:32:13 +08:00
parent 8ff20c25f3
commit 498ac8238d
No known key found for this signature in database
GPG Key ID: 23BD4CCD326E9D64
1 changed files with 6 additions and 2 deletions

View File

@ -131,9 +131,13 @@ zstd_cstream *zstd_init_cstream(const zstd_parameters *parameters,
EXPORT_SYMBOL(zstd_init_cstream);
size_t zstd_reset_cstream(zstd_cstream *cstream,
unsigned long long pledgedSrcSize)
unsigned long long pledged_src_size)
{
return ZSTD_CCtx_setPledgedSrcSize(cstream, pledgedSrcSize);
if (pledged_src_size == 0)
pledged_src_size = ZSTD_CONTENTSIZE_UNKNOWN;
ZSTD_FORWARD_IF_ERR( ZSTD_CCtx_reset(cstream, ZSTD_reset_session_only) );
ZSTD_FORWARD_IF_ERR( ZSTD_CCtx_setPledgedSrcSize(cstream, pledged_src_size) );
return 0;
}
EXPORT_SYMBOL(zstd_reset_cstream);