mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/zlib/zlib.c (gzfile_read_all): use gzfile_newstr;
set and convert its encoding. [ruby-dev:38304] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ebabbc6cb9
commit
80918e2ac9
3 changed files with 10 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sun Aug 30 01:15:31 2009 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/zlib/zlib.c (gzfile_read_all): use gzfile_newstr;
|
||||||
|
set and convert its encoding. [ruby-dev:38304]
|
||||||
|
|
||||||
Sat Aug 29 20:40:02 2009 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
Sat Aug 29 20:40:02 2009 Yuki Sonoda (Yugui) <yugui@yugui.jp>
|
||||||
|
|
||||||
* vm_eval.c (rb_call0): gets rid of checking method cache twice.
|
* vm_eval.c (rb_call0): gets rid of checking method cache twice.
|
||||||
|
|
|
@ -2202,7 +2202,7 @@ gzfile_read_all(struct gzfile *gz)
|
||||||
dst = zstream_detach_buffer(&gz->z);
|
dst = zstream_detach_buffer(&gz->z);
|
||||||
gzfile_calc_crc(gz, dst);
|
gzfile_calc_crc(gz, dst);
|
||||||
OBJ_TAINT(dst);
|
OBJ_TAINT(dst);
|
||||||
return dst;
|
return gzfile_newstr(gz, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
|
|
@ -470,10 +470,12 @@ if defined? Zlib
|
||||||
def test_read
|
def test_read
|
||||||
t = Tempfile.new("test_zlib_gzip_reader")
|
t = Tempfile.new("test_zlib_gzip_reader")
|
||||||
t.close
|
t.close
|
||||||
Zlib::GzipWriter.open(t.path) {|gz| gz.print("foobar") }
|
str = "\u3042\u3044\u3046"
|
||||||
|
Zlib::GzipWriter.open(t.path) {|gz| gz.print(str) }
|
||||||
|
|
||||||
f = Zlib::GzipReader.open(t.path)
|
f = Zlib::GzipReader.open(t.path, encoding: "UTF-8")
|
||||||
assert_raise(ArgumentError) { f.read(-1) }
|
assert_raise(ArgumentError) { f.read(-1) }
|
||||||
|
assert_equal(str, f.read)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_readpartial
|
def test_readpartial
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue