summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/zlib/extconf.rb1
-rw-r--r--ext/zlib/zlib.c6
2 files changed, 6 insertions, 1 deletions
diff --git a/ext/zlib/extconf.rb b/ext/zlib/extconf.rb
index 499f55a0464..d94fea743b4 100644
--- a/ext/zlib/extconf.rb
+++ b/ext/zlib/extconf.rb
@@ -58,6 +58,7 @@ if %w'z libz zlib1 zlib zdll'.find {|z| have_library(z, 'deflateReset')} and
have_func('crc32_combine', 'zlib.h')
have_func('adler32_combine', 'zlib.h')
+ have_type('z_crc_t', 'zlib.h')
create_makefile('zlib')
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index d8cbe2fd657..fee74bfc98e 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -505,7 +505,11 @@ rb_zlib_crc32_combine(VALUE klass, VALUE crc1, VALUE crc2, VALUE len2)
static VALUE
rb_zlib_crc_table(VALUE obj)
{
- const unsigned long *crctbl;
+#if !defined(HAVE_TYPE_Z_CRC_T)
+ /* z_crc_t is defined since zlib-1.2.7. */
+ typedef unsigned long z_crc_t;
+#endif
+ const z_crc_t *crctbl;
VALUE dst;
int i;