]> git.ipfire.org Git - thirdparty/zstd.git/commit
[contrib][linux] Use ZSTD_CCtx_setPledgedSrcSize() instead of ZSTD_CCtx_reset()
authorCyber Knight <cyberknight755@gmail.com>
Tue, 8 Mar 2022 05:38:06 +0000 (13:38 +0800)
committerCyber Knight <cyberknight755@gmail.com>
Tue, 8 Mar 2022 05:38:34 +0000 (13:38 +0800)
commit8ff20c25f38f62cd1e898cf81173e280f42327f5
tree088ce978e33f42ee52d47a7cae9c839604727811
parente470c940f6cb6cfff4b27d595ec651a3c1c2cc15
[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 <anonymous>’} 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 <cyberknight755@gmail.com>
contrib/linux-kernel/zstd_compress_module.c