44
44
#endif
45
45
#endif
46
46
47
+ #if defined(HAVE_TYPE_Z_SIZE_T )
48
+ typedef uLong (* checksum_func )(uLong , const Bytef * , z_size_t );
49
+ # define crc32 crc32_z
50
+ # define adler32 adler32_z
51
+ #else
52
+ typedef uLong (* checksum_func )(uLong , const Bytef * , uInt );
53
+ #endif
54
+
47
55
#if SIZEOF_LONG > SIZEOF_INT
48
56
static inline uInt
49
57
max_uint (long n )
@@ -65,7 +73,7 @@ static ID id_dictionaries, id_read, id_buffer;
65
73
66
74
static NORETURN (void raise_zlib_error (int , const char * )) ;
67
75
static VALUE rb_zlib_version (VALUE );
68
- static VALUE do_checksum (int , VALUE * , uLong ( * )( uLong , const Bytef * , uInt ) );
76
+ static VALUE do_checksum (int , VALUE * , checksum_func );
69
77
static VALUE rb_zlib_adler32 (int , VALUE * , VALUE );
70
78
static VALUE rb_zlib_crc32 (int , VALUE * , VALUE );
71
79
static VALUE rb_zlib_crc_table (VALUE );
@@ -380,7 +388,7 @@ rb_zlib_version(VALUE klass)
380
388
# define mask32 (x ) (x)
381
389
#endif
382
390
383
- #if SIZEOF_LONG > SIZEOF_INT
391
+ #if SIZEOF_LONG > SIZEOF_INT && !defined( HAVE_TYPE_Z_SIZE_T )
384
392
static uLong
385
393
checksum_long (uLong (* func )(uLong , const Bytef * , uInt ), uLong sum , const Bytef * ptr , long len )
386
394
{
@@ -399,7 +407,7 @@ checksum_long(uLong (*func)(uLong, const Bytef*, uInt), uLong sum, const Bytef *
399
407
#endif
400
408
401
409
static VALUE
402
- do_checksum (int argc , VALUE * argv , uLong ( * func )( uLong , const Bytef * , uInt ) )
410
+ do_checksum (int argc , VALUE * argv , checksum_func func )
403
411
{
404
412
VALUE str , vsum ;
405
413
unsigned long sum ;
0 commit comments