зеркало из https://github.com/github/ruby.git
* 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:
Родитель
b15e66669f
Коммит
a3a55eb550
|
@ -1,3 +1,7 @@
|
|||
Sat Aug 7 00:50:01 2004 Tanaka Akira <akr@m17n.org>
|
||||
|
||||
* ext/zlib/zlib.c: Zlib::GzipReader#read(0) returns "" instead of nil.
|
||||
|
||||
Mon Aug 3 13:49:12 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tk/lib/tk/namespace.rb: bug fix
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
require 'test/unit/testsuite'
|
||||
require 'test/unit/testcase'
|
||||
require 'stringio'
|
||||
|
||||
begin
|
||||
require 'zlib'
|
||||
|
@ -7,6 +8,13 @@ rescue LoadError
|
|||
end
|
||||
|
||||
if defined? Zlib
|
||||
class TestZlibGzipReader < Test::Unit::TestCase
|
||||
D0 = "\037\213\010\000S`\017A\000\003\003\000\000\000\000\000\000\000\000\000"
|
||||
def test_read0
|
||||
assert_equal("", Zlib::GzipReader.new(StringIO.new(D0)).read(0))
|
||||
end
|
||||
end
|
||||
|
||||
class TestZlibGzipWriter < Test::Unit::TestCase
|
||||
def test_invalid_new
|
||||
# [ruby-dev:23228]
|
||||
|
|
Загрузка…
Ссылка в новой задаче