Skip to content

Commit

Permalink
Apply crc_t fixes to zlib extension
Browse files Browse the repository at this point in the history
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
dbussink committed Jul 5, 2012
1 parent d24264d commit 290404f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/18/zlib/ext/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@

$defs.concat(defines.collect{|d|' -D'+d})

have_type('z_crc_t', 'zlib.h')

create_makefile('zlib')

end
6 changes: 5 additions & 1 deletion lib/18/zlib/ext/zlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions lib/19/zlib/ext/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
6 changes: 5 additions & 1 deletion lib/19/zlib/ext/zlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 290404f

Please sign in to comment.