|
14 | 14 |
|
15 | 15 | #ifndef HAVE_RB_LEN_T |
16 | 16 | typedef long rb_len_t; |
| 17 | +typedef unsigned long rb_ulen_t; |
| 18 | +# define SIZEOF_RB_LEN_T SIZEOF_LONG |
17 | 19 | # define NUM2LEN NUM2LONG |
18 | 20 | # define PRIdLEN "ld" |
19 | 21 | #endif |
@@ -58,9 +60,9 @@ typedef uLong (*checksum_func)(uLong, const Bytef*, z_size_t); |
58 | 60 | typedef uLong (*checksum_func)(uLong, const Bytef*, uInt); |
59 | 61 | #endif |
60 | 62 |
|
61 | | -#if SIZEOF_LONG > SIZEOF_INT |
| 63 | +#if SIZEOF_RB_LEN_T > SIZEOF_INT |
62 | 64 | static inline uInt |
63 | | -max_uint(long n) |
| 65 | +max_uint(rb_len_t n) |
64 | 66 | { |
65 | 67 | if (n > UINT_MAX) n = UINT_MAX; |
66 | 68 | return (uInt)n; |
@@ -92,12 +94,12 @@ struct zstream_funcs; |
92 | 94 | struct zstream_run_args; |
93 | 95 | static void zstream_init(struct zstream*, const struct zstream_funcs*); |
94 | 96 | static void zstream_expand_buffer(struct zstream*); |
95 | | -static void zstream_expand_buffer_into(struct zstream*, unsigned long); |
| 97 | +static void zstream_expand_buffer_into(struct zstream*, rb_ulen_t); |
96 | 98 | static int zstream_expand_buffer_non_stream(struct zstream *z); |
97 | 99 | static void zstream_append_buffer(struct zstream*, const Bytef*, rb_len_t); |
98 | 100 | static VALUE zstream_detach_buffer(struct zstream*); |
99 | 101 | static VALUE zstream_shift_buffer(struct zstream*, rb_len_t, VALUE); |
100 | | -static void zstream_buffer_ungets(struct zstream*, const Bytef*, unsigned long); |
| 102 | +static void zstream_buffer_ungets(struct zstream*, const Bytef*, rb_ulen_t); |
101 | 103 | static void zstream_buffer_ungetbyte(struct zstream*, int); |
102 | 104 | static void zstream_append_input(struct zstream*, const Bytef*, rb_len_t); |
103 | 105 | static void zstream_discard_input(struct zstream*, rb_len_t); |
@@ -394,7 +396,7 @@ rb_zlib_version(VALUE klass) |
394 | 396 | # define mask32(x) (x) |
395 | 397 | #endif |
396 | 398 |
|
397 | | -#if SIZEOF_LONG > SIZEOF_INT && !defined(HAVE_ZLIB_SIZE_T_FUNCS) |
| 399 | +#if SIZEOF_RB_LEN_T > SIZEOF_INT && !defined(HAVE_ZLIB_SIZE_T_FUNCS) |
398 | 400 | static uLong |
399 | 401 | checksum_long(uLong (*func)(uLong, const Bytef*, uInt), uLong sum, const Bytef *ptr, rb_len_t len) |
400 | 402 | { |
@@ -708,7 +710,7 @@ zstream_expand_buffer(struct zstream *z) |
708 | 710 | } |
709 | 711 |
|
710 | 712 | static void |
711 | | -zstream_expand_buffer_into(struct zstream *z, unsigned long size) |
| 713 | +zstream_expand_buffer_into(struct zstream *z, rb_ulen_t size) |
712 | 714 | { |
713 | 715 | if (NIL_P(z->buf)) { |
714 | 716 | /* I uses rb_str_new here not rb_str_buf_new because |
@@ -862,7 +864,7 @@ zstream_shift_buffer(struct zstream *z, rb_len_t len, VALUE dst) |
862 | 864 | } |
863 | 865 |
|
864 | 866 | static void |
865 | | -zstream_buffer_ungets(struct zstream *z, const Bytef *b, unsigned long len) |
| 867 | +zstream_buffer_ungets(struct zstream *z, const Bytef *b, rb_ulen_t len) |
866 | 868 | { |
867 | 869 | char *bufptr; |
868 | 870 | rb_len_t filled; |
|
0 commit comments