madler / zlib

A massively spiffy yet delicately unobtrusive compression library.
http://zlib.net/
Other
5.71k stars 2.45k forks source link

Nitpick: infcover.c errors with pointer mismatch when libz is compiled with -DZLIB_CONST #991

Closed NickEfthymiou closed 3 months ago

NickEfthymiou commented 3 months ago

Clang error: infcover.c:563:34: error: incompatible function pointer types passing 'unsigned int (void *, unsigned char )' to parameter of type 'in_func' (aka 'unsigned int ()(void , const unsigned char )') [-Wincompatible-function-pointer-types] 563 | ret = inflateBack(&strm, pull, Z_NULL, push, Z_NULL);

Easy fix: pull() needs conditional, something like

/ input and output functions for inflateBack() /

if defined(ZLIB_CONST)

local unsigned pull(void *desc, const unsigned char **buf)

else

local unsigned pull(void *desc, unsigned char **buf)

endif

{

Thank you for zlib! Humanity has probably saved exabytes because it exists:)

madler commented 3 months ago

Thanks. Fixed in https://github.com/madler/zlib/commit/ceadaf28dfa48dbf238a0ddb884d4c543b4170e8 .