Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix misdetection of {crc32,alder32}_z in cloudflare zlib fork #68

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions ext/zlib/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,16 @@
$defs << "-DHAVE_CRC32_COMBINE"
$defs << "-DHAVE_ADLER32_COMBINE"
$defs << "-DHAVE_TYPE_Z_CRC_T"
$defs << "-DHAVE_TYPE_Z_SIZE_T"
$defs << "-DHAVE_CRC32_Z"
$defs << "-DHAVE_ADLER32_Z"
$defs << "-DHAVE_ZLIB_SIZE_T_FUNCS"
else
have_func('crc32_combine', 'zlib.h')
have_func('adler32_combine', 'zlib.h')
have_type('z_crc_t', 'zlib.h')
have_type('z_size_t', 'zlib.h')
if have_func('crc32_z', 'zlib.h') && have_func('adler32_z', 'zlib.h')
$defs << "-DHAVE_ZLIB_SIZE_T_FUNCS"
end
end

create_makefile('zlib') {|conf|
Expand Down
4 changes: 2 additions & 2 deletions ext/zlib/zlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#endif
#endif

#if defined(HAVE_TYPE_Z_SIZE_T)
#if defined(HAVE_ZLIB_SIZE_T_FUNCS)
typedef uLong (*checksum_func)(uLong, const Bytef*, z_size_t);
# define crc32 crc32_z
# define adler32 adler32_z
Expand Down Expand Up @@ -388,7 +388,7 @@ rb_zlib_version(VALUE klass)
# define mask32(x) (x)
#endif

#if SIZEOF_LONG > SIZEOF_INT && !defined(HAVE_TYPE_Z_SIZE_T)
#if SIZEOF_LONG > SIZEOF_INT && !defined(HAVE_ZLIB_SIZE_T_FUNCS)
static uLong
checksum_long(uLong (*func)(uLong, const Bytef*, uInt), uLong sum, const Bytef *ptr, long len)
{
Expand Down