summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-08-06 16:01:02 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-08-06 16:01:02 +0000
commitaf6f2cfc167e096bb193614fda22e7ffae0d90d6 (patch)
tree03d33582b960b69c6760424a0b44b869e8f9795c /ext
parent82fd1b704a0e0129efac03db8e926b568b64293c (diff)
downloadruby-af6f2cfc167e096bb193614fda22e7ffae0d90d6.tar.gz
ruby-af6f2cfc167e096bb193614fda22e7ffae0d90d6.tar.xz
ruby-af6f2cfc167e096bb193614fda22e7ffae0d90d6.zip
* ext/zlib/zlib.c: Zlib::GzipReader#read(0) returns "" instead of nil.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@6739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/zlib/zlib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 38ab667cd..0e9d9a679 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -2072,7 +2072,10 @@ gzfile_read(gz, len)
{
VALUE dst;
- if (len <= 0) return Qnil;
+ if (len < 0)
+ rb_raise(rb_eArgError, "negative length %d given", len);
+ if (len == 0)
+ return rb_str_new(0, 0);
while (!ZSTREAM_IS_FINISHED(&gz->z) && gz->z.buf_filled < len) {
gzfile_read_more(gz);
}