From: Cyber Knight Date: Tue, 8 Mar 2022 05:38:06 +0000 (+0800) Subject: [contrib][linux] Use ZSTD_CCtx_setPledgedSrcSize() instead of ZSTD_CCtx_reset() X-Git-Tag: v1.5.4^2~227^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ff20c25f38f62cd1e898cf81173e280f42327f5;p=thirdparty%2Fzstd.git [contrib][linux] Use ZSTD_CCtx_setPledgedSrcSize() instead of ZSTD_CCtx_reset() - The previous patch throws the following warning: ../linux/lib/zstd/zstd_compress_module.c: In function ‘zstd_reset_cstream’: ../linux/lib/zstd/zstd_compress_module.c:136:34: error: enum conversion when passing argument 2 of ‘ZSTD_CCtx_reset’ is invalid in C++ [-Werror=c++-compat] 136 | return ZSTD_CCtx_reset(cstream, pledged_src_size); | ^~~~~~~~~~~~~~~~ In file included from ../linux/include/linux/zstd.h:26, from ../linux/lib/zstd/zstd_compress_module.c:15: ../linux/include/linux/zstd_lib.h:501:20: note: expected ‘ZSTD_ResetDirective’ {aka ‘enum ’} but argument is of type ‘long long unsigned int’ 501 | ZSTDLIB_API size_t ZSTD_CCtx_reset(ZSTD_CCtx* cctx, ZSTD_ResetDirective reset); | ^~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Since we have a choice to either use ZSTD_CCtx_reset or ZSTD_CCtx_setPledgedSrcSize instead of ZSTD_resetCStream, let's switch to ZSTD_CCtx_setPledgedSrcSize to not have any unnecessary warns alongside the kernel build and CI test build. Signed-off-by: Cyber Knight --- diff --git a/contrib/linux-kernel/zstd_compress_module.c b/contrib/linux-kernel/zstd_compress_module.c index 7b25be6e3..8b4c764d4 100644 --- a/contrib/linux-kernel/zstd_compress_module.c +++ b/contrib/linux-kernel/zstd_compress_module.c @@ -131,9 +131,9 @@ 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 pledged_src_size) + unsigned long long pledgedSrcSize) { - return ZSTD_CCtx_reset(cstream, pledged_src_size); + return ZSTD_CCtx_setPledgedSrcSize(cstream, pledgedSrcSize); } EXPORT_SYMBOL(zstd_reset_cstream);