1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* encoding.c (enc_replicate): new encoding name must be valid

c-string.  [ruby-dev:40954]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-04-11 03:08:51 +00:00
parent 021e7b7f20
commit 9f9ace81f8
3 changed files with 7 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Sun Apr 11 12:08:49 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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@ruby-lang.org>
* include/ruby/win32.h (ftruncate): rename to get rid of conflict

View file

@ -326,7 +326,7 @@ static VALUE
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)));
}

View file

@ -54,6 +54,7 @@ class TestEncoding < Test::Unit::TestCase
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