From aeb8d7f5e591915d7c4e290a3bee3185c84f0630 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 25 Dec 2010 01:59:15 +0000 Subject: * ext/zlib/zlib.c (gzfile_read, gzfile_readpartial): length should be long. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/zlib/zlib.c | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 628425838a..e927b61af5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Dec 25 10:59:12 2010 Nobuyoshi Nakada + + * ext/zlib/zlib.c (gzfile_read, gzfile_readpartial): length should + be long. + Sat Dec 25 10:51:03 2010 Nobuyoshi Nakada * ext/json/generator/generator.c (fbuffer_free): unused. diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index 3dd5699bdf..458a7009e0 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -141,7 +141,7 @@ static void gzfile_check_footer(struct gzfile*); static void gzfile_write(struct gzfile*, Bytef*, uInt); static long gzfile_read_more(struct gzfile*); static void gzfile_calc_crc(struct gzfile*, VALUE); -static VALUE gzfile_read(struct gzfile*, int); +static VALUE gzfile_read(struct gzfile*, long); static VALUE gzfile_read_all(struct gzfile*); static void gzfile_ungets(struct gzfile*, const Bytef*, int); static void gzfile_ungetbyte(struct gzfile*, int); @@ -2205,12 +2205,12 @@ gzfile_newstr(struct gzfile *gz, VALUE str) } static VALUE -gzfile_read(struct gzfile *gz, int len) +gzfile_read(struct gzfile *gz, long len) { VALUE dst; if (len < 0) - rb_raise(rb_eArgError, "negative length %d given", len); + rb_raise(rb_eArgError, "negative length %ld given", len); if (len == 0) return rb_str_new(0, 0); while (!ZSTREAM_IS_FINISHED(&gz->z) && gz->z.buf_filled < len) { @@ -2229,15 +2229,15 @@ gzfile_read(struct gzfile *gz, int len) } static VALUE -gzfile_readpartial(struct gzfile *gz, int len, VALUE outbuf) +gzfile_readpartial(struct gzfile *gz, long len, VALUE outbuf) { VALUE dst; if (len < 0) - rb_raise(rb_eArgError, "negative length %d given", len); + rb_raise(rb_eArgError, "negative length %ld given", len); if (!NIL_P(outbuf)) - OBJ_TAINT(outbuf); + OBJ_TAINT(outbuf); if (len == 0) { if (NIL_P(outbuf)) @@ -3154,7 +3154,7 @@ rb_gzreader_read(int argc, VALUE *argv, VALUE obj) { struct gzfile *gz = get_gzfile(obj); VALUE vlen; - int len; + long len; rb_scan_args(argc, argv, "01", &vlen); if (NIL_P(vlen)) { @@ -3163,7 +3163,7 @@ rb_gzreader_read(int argc, VALUE *argv, VALUE obj) len = NUM2INT(vlen); if (len < 0) { - rb_raise(rb_eArgError, "negative length %d given", len); + rb_raise(rb_eArgError, "negative length %ld given", len); } return gzfile_read(gz, len); } @@ -3183,13 +3183,13 @@ rb_gzreader_readpartial(int argc, VALUE *argv, VALUE obj) { struct gzfile *gz = get_gzfile(obj); VALUE vlen, outbuf; - int len; + long len; rb_scan_args(argc, argv, "11", &vlen, &outbuf); len = NUM2INT(vlen); if (len < 0) { - rb_raise(rb_eArgError, "negative length %d given", len); + rb_raise(rb_eArgError, "negative length %ld given", len); } if (!NIL_P(outbuf)) Check_Type(outbuf, T_STRING); -- cgit v1.2.3