Permalink
Browse files

Apply crc_t fixes to zlib extension

We already fixed this issue in the previous FFI version. This is also
fixed in MRI trunk, which is where this change is copied from.
  • Loading branch information...
1 parent d24264d commit 290404fae3d54d7c5e38154b894871b2e2c10abf @dbussink dbussink committed Jul 5, 2012
Showing with 13 additions and 2 deletions.
  1. +2 −0 lib/18/zlib/ext/extconf.rb
  2. +5 −1 lib/18/zlib/ext/zlib.c
  3. +1 −0 lib/19/zlib/ext/extconf.rb
  4. +5 −1 lib/19/zlib/ext/zlib.c
@@ -56,6 +56,8 @@
$defs.concat(defines.collect{|d|' -D'+d})
+ have_type('z_crc_t', 'zlib.h')
+
create_makefile('zlib')
end
View
@@ -342,7 +342,11 @@ static VALUE
rb_zlib_crc_table(obj)
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;
@@ -58,6 +58,7 @@
have_func('crc32_combine', 'zlib.h')
have_func('adler32_combine', 'zlib.h')
+ have_type('z_crc_t', 'zlib.h')
create_makefile('zlib')
View
@@ -464,7 +464,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;

0 comments on commit 290404f

Please sign in to comment.