ruby-changes:12962
From: naruse <ko1@a...>
Date: Sun, 30 Aug 2009 01:17:43 +0900 (JST)
Subject: [ruby-changes:12962] Ruby:r24704 (trunk): * ext/zlib/zlib.c (gzfile_read_all): use gzfile_newstr;
naruse 2009-08-30 01:17:26 +0900 (Sun, 30 Aug 2009) New Revision: 24704 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=24704 Log: * ext/zlib/zlib.c (gzfile_read_all): use gzfile_newstr; set and convert its encoding. [ruby-dev:38304] Modified files: trunk/ChangeLog trunk/ext/zlib/zlib.c trunk/test/zlib/test_zlib.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 24703) +++ ChangeLog (revision 24704) @@ -1,3 +1,8 @@ +Sun Aug 30 01:15:31 2009 NARUSE, Yui <naruse@r...> + + * 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@y...> * vm_eval.c (rb_call0): gets rid of checking method cache twice. Index: ext/zlib/zlib.c =================================================================== --- ext/zlib/zlib.c (revision 24703) +++ ext/zlib/zlib.c (revision 24704) @@ -2202,7 +2202,7 @@ dst = zstream_detach_buffer(&gz->z); gzfile_calc_crc(gz, dst); OBJ_TAINT(dst); - return dst; + return gzfile_newstr(gz, dst); } static VALUE Index: test/zlib/test_zlib.rb =================================================================== --- test/zlib/test_zlib.rb (revision 24703) +++ test/zlib/test_zlib.rb (revision 24704) @@ -470,10 +470,12 @@ def test_read t = Tempfile.new("test_zlib_gzip_reader") 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_equal(str, f.read) end def test_readpartial -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/