1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2010-12-25 01:59:15 +00:00
parent bd3c7a7e90
commit aeb8d7f5e5
2 changed files with 15 additions and 10 deletions

View file

@ -1,3 +1,8 @@
Sat Dec 25 10:59:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/zlib/zlib.c (gzfile_read, gzfile_readpartial): length should
be long.
Sat Dec 25 10:51:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> Sat Dec 25 10:51:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/json/generator/generator.c (fbuffer_free): unused. * ext/json/generator/generator.c (fbuffer_free): unused.

View file

@ -141,7 +141,7 @@ static void gzfile_check_footer(struct gzfile*);
static void gzfile_write(struct gzfile*, Bytef*, uInt); static void gzfile_write(struct gzfile*, Bytef*, uInt);
static long gzfile_read_more(struct gzfile*); static long gzfile_read_more(struct gzfile*);
static void gzfile_calc_crc(struct gzfile*, VALUE); 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 VALUE gzfile_read_all(struct gzfile*);
static void gzfile_ungets(struct gzfile*, const Bytef*, int); static void gzfile_ungets(struct gzfile*, const Bytef*, int);
static void gzfile_ungetbyte(struct gzfile*, int); static void gzfile_ungetbyte(struct gzfile*, int);
@ -2205,12 +2205,12 @@ gzfile_newstr(struct gzfile *gz, VALUE str)
} }
static VALUE static VALUE
gzfile_read(struct gzfile *gz, int len) gzfile_read(struct gzfile *gz, long len)
{ {
VALUE dst; VALUE dst;
if (len < 0) if (len < 0)
rb_raise(rb_eArgError, "negative length %d given", len); rb_raise(rb_eArgError, "negative length %ld given", len);
if (len == 0) if (len == 0)
return rb_str_new(0, 0); return rb_str_new(0, 0);
while (!ZSTREAM_IS_FINISHED(&gz->z) && gz->z.buf_filled < len) { while (!ZSTREAM_IS_FINISHED(&gz->z) && gz->z.buf_filled < len) {
@ -2229,15 +2229,15 @@ gzfile_read(struct gzfile *gz, int len)
} }
static VALUE static VALUE
gzfile_readpartial(struct gzfile *gz, int len, VALUE outbuf) gzfile_readpartial(struct gzfile *gz, long len, VALUE outbuf)
{ {
VALUE dst; VALUE dst;
if (len < 0) 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)) if (!NIL_P(outbuf))
OBJ_TAINT(outbuf); OBJ_TAINT(outbuf);
if (len == 0) { if (len == 0) {
if (NIL_P(outbuf)) if (NIL_P(outbuf))
@ -3154,7 +3154,7 @@ rb_gzreader_read(int argc, VALUE *argv, VALUE obj)
{ {
struct gzfile *gz = get_gzfile(obj); struct gzfile *gz = get_gzfile(obj);
VALUE vlen; VALUE vlen;
int len; long len;
rb_scan_args(argc, argv, "01", &vlen); rb_scan_args(argc, argv, "01", &vlen);
if (NIL_P(vlen)) { if (NIL_P(vlen)) {
@ -3163,7 +3163,7 @@ rb_gzreader_read(int argc, VALUE *argv, VALUE obj)
len = NUM2INT(vlen); len = NUM2INT(vlen);
if (len < 0) { 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); return gzfile_read(gz, len);
} }
@ -3183,13 +3183,13 @@ rb_gzreader_readpartial(int argc, VALUE *argv, VALUE obj)
{ {
struct gzfile *gz = get_gzfile(obj); struct gzfile *gz = get_gzfile(obj);
VALUE vlen, outbuf; VALUE vlen, outbuf;
int len; long len;
rb_scan_args(argc, argv, "11", &vlen, &outbuf); rb_scan_args(argc, argv, "11", &vlen, &outbuf);
len = NUM2INT(vlen); len = NUM2INT(vlen);
if (len < 0) { 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)) if (!NIL_P(outbuf))
Check_Type(outbuf, T_STRING); Check_Type(outbuf, T_STRING);