ruby-changes:15408
From: nobu <ko1@a...>
Date: Sun, 11 Apr 2010 12:09:07 +0900 (JST)
Subject: [ruby-changes:15408] Ruby:r27301 (trunk): * encoding.c (enc_replicate): new encoding name must be valid
nobu 2010-04-11 12:08:51 +0900 (Sun, 11 Apr 2010) New Revision: 27301 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27301 Log: * encoding.c (enc_replicate): new encoding name must be valid c-string. [ruby-dev:40954] Modified files: trunk/ChangeLog trunk/encoding.c trunk/test/ruby/test_encoding.rb Index: encoding.c =================================================================== --- encoding.c (revision 27300) +++ encoding.c (revision 27301) @@ -326,7 +326,7 @@ enc_replicate(VALUE encoding, VALUE name) { return rb_enc_from_encoding_index( - rb_enc_replicate(RSTRING_PTR(name), + rb_enc_replicate(StringValueCStr(name), rb_to_encoding(encoding))); } Index: ChangeLog =================================================================== --- ChangeLog (revision 27300) +++ ChangeLog (revision 27301) @@ -1,3 +1,8 @@ +Sun Apr 11 12:08:49 2010 Nobuyoshi Nakada <nobu@r...> + + * encoding.c (enc_replicate): new encoding name must be valid + c-string. [ruby-dev:40954] + Sun Apr 11 11:58:23 2010 Nobuyoshi Nakada <nobu@r...> * include/ruby/win32.h (ftruncate): rename to get rid of conflict Index: test/ruby/test_encoding.rb =================================================================== --- test/ruby/test_encoding.rb (revision 27300) +++ test/ruby/test_encoding.rb (revision 27301) @@ -54,6 +54,7 @@ def test_replicate assert(Encoding::UTF_8.replicate('UTF-8-ANOTHER')) assert(Encoding::ISO_2022_JP.replicate('ISO-2022-JP-ANOTHER')) + assert_raise(TypeError, bug3127 = '[ruby-dev:40954]') {Encoding::UTF_8.replicate(0)} end def test_dummy_p -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/