[前][次][番号順一覧][スレッド一覧]

ruby-changes:18317

From: nobu <ko1@a...>
Date: Sat, 25 Dec 2010 10:59:21 +0900 (JST)
Subject: [ruby-changes:18317] Ruby:r30340 (trunk): * ext/zlib/zlib.c (gzfile_read, gzfile_readpartial): length should

nobu	2010-12-25 10:59:15 +0900 (Sat, 25 Dec 2010)

  New Revision: 30340

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30340

  Log:
    * ext/zlib/zlib.c (gzfile_read, gzfile_readpartial): length should
      be long.

  Modified files:
    trunk/ChangeLog
    trunk/ext/zlib/zlib.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30339)
+++ ChangeLog	(revision 30340)
@@ -1,3 +1,8 @@
+Sat Dec 25 10:59:12 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/zlib/zlib.c (gzfile_read, gzfile_readpartial): length should
+	  be long.
+
 Sat Dec 25 10:51:03 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/json/generator/generator.c (fbuffer_free): unused.
Index: ext/zlib/zlib.c
===================================================================
--- ext/zlib/zlib.c	(revision 30339)
+++ ext/zlib/zlib.c	(revision 30340)
@@ -141,7 +141,7 @@
 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 @@
 }
 
 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 @@
 }
 
 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 @@
 {
     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 @@
 
     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 @@
 {
     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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]