Skip to content

Commit

Permalink
lib: zstd: Revise the warning fix at zstd_reset_cstream()
Browse files Browse the repository at this point in the history
Subsequent to 15f1b5e137 {"lib: zstd: Fix a warning in zstd_reset_cstream()"}

- As referenced by Nick Terrelln ~ the ZSTD maintainer in the linux kernel [1], 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.

[1]: facebook/zstd#3088 (comment)

Suggested-by: Nick Terrell <[email protected]>
Signed-off-by: Cyber Knight <[email protected]>
  • Loading branch information
cyberknight777 authored and taalojarvi committed Mar 25, 2022
1 parent 34f7dc5 commit add7b85
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/zstd/zstd_compress_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,11 @@ EXPORT_SYMBOL(zstd_init_cstream);
size_t zstd_reset_cstream(zstd_cstream *cstream,
unsigned long long pledged_src_size)
{
return ZSTD_CCtx_reset(cstream, pledged_src_size);
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);

Expand Down

0 comments on commit add7b85

Please sign in to comment.