diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index e279bb9..5dcc7cf 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -15,9 +15,23 @@ #ifndef HAVE_RB_LEN_T typedef long rb_len_t; typedef unsigned long rb_ulen_t; +#endif +#ifndef SIZEOF_RB_LEN_T # define SIZEOF_RB_LEN_T SIZEOF_LONG +#endif +#ifndef LEN2NUM # define LEN2NUM LONG2NUM +#endif +#ifndef ULEN2NUM +# define ULEN2NUM ULONG2NUM +#endif +#ifndef NUM2LEN # define NUM2LEN NUM2LONG +#endif +#ifndef NUM2ULEN +# define NUM2ULEN NUM2ULONG +#endif +#ifndef PRIdLEN # define PRIdLEN "ld" #endif @@ -532,8 +546,8 @@ rb_zlib_crc32(int argc, VALUE *argv, VALUE klass) static VALUE rb_zlib_crc32_combine(VALUE klass, VALUE crc1, VALUE crc2, VALUE len2) { - return ULONG2NUM( - crc32_combine(NUM2ULONG(crc1), NUM2ULONG(crc2), NUM2LONG(len2))); + return ULEN2NUM( + crc32_combine(NUM2ULONG(crc1), NUM2ULONG(crc2), NUM2ULEN(len2))); } #else #define rb_zlib_crc32_combine rb_f_notimplement