summaryrefslogtreecommitdiff
path: root/ext/zlib/zlib.c
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
commita3a55eb5508957ab4cf7f85ff1a8d80b8e3aa758 (patch)
tree58f6dcf561b76c4a3346e8be1ada8f567a0d4668 /ext/zlib/zlib.c
parentb15e66669f680606232ed6a0ab6e88c96a95f7d7 (diff)
* ext/zlib/zlib.c: Zlib::GzipReader#read(0) returns "" instead of nil.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/zlib/zlib.c')
-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 e665b7b6b2..c5e9e7437c 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -2075,7 +2075,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);
}