mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
b15e66669f
commit
a3a55eb550
3 changed files with 16 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue