From f50e791c028457465ece677f055f2e2092b6e19c Mon Sep 17 00:00:00 2001 From: yugui Date: Wed, 28 Oct 2009 16:11:37 +0000 Subject: [PATCH] merges r24704 from trunk into ruby_1_9_1. -- * 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/branches/ruby_1_9_1@25548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/zlib/zlib.c | 2 +- test/zlib/test_zlib.rb | 6 ++++-- version.h | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 23ea369573..fa801c4ecb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Aug 30 01:15:31 2009 NARUSE, Yui + + * ext/zlib/zlib.c (gzfile_read_all): use gzfile_newstr; + set and convert its encoding. [ruby-dev:38304] + Thu Aug 27 18:31:07 2009 Nobuyoshi Nakada * vm_method.c (rb_remove_method_id): exported. diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index ffc566197c..2c9fcbc9f6 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -2198,7 +2198,7 @@ gzfile_read_all(struct gzfile *gz) dst = zstream_detach_buffer(&gz->z); gzfile_calc_crc(gz, dst); OBJ_TAINT(dst); - return dst; + return gzfile_newstr(gz, dst); } static VALUE diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb index 9e4cf80033..6301720770 100644 --- a/test/zlib/test_zlib.rb +++ b/test/zlib/test_zlib.rb @@ -442,10 +442,12 @@ if defined? Zlib 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 diff --git a/version.h b/version.h index 9436d98190..dc0eafa76a 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.1" -#define RUBY_PATCHLEVEL 306 +#define RUBY_PATCHLEVEL 307 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1