ruby-changes:11530
From: mame <ko1@a...>
Date: Wed, 8 Apr 2009 22:06:38 +0900 (JST)
Subject: [ruby-changes:11530] Ruby:r23160 (trunk): * string.c (rb_str_dump): buffer length plus one byte for null
mame 2009-04-08 22:05:07 +0900 (Wed, 08 Apr 2009) New Revision: 23160 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23160 Log: * string.c (rb_str_dump): buffer length plus one byte for null terminator. [ruby-dev:38294] * test/ruby/test_m17n.rb (test_str_dump): add a test for above. Modified files: trunk/ChangeLog trunk/string.c trunk/test/ruby/test_m17n.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 23159) +++ ChangeLog (revision 23160) @@ -1,3 +1,10 @@ +Wed Apr 8 21:58:12 2009 Yusuke Endoh <mame@t...> + + * string.c (rb_str_dump): buffer length plus one byte for null + terminator. [ruby-dev:38294] + + * test/ruby/test_m17n.rb (test_str_dump): add a test for above. + Wed Apr 8 20:08:16 2009 Nobuyoshi Nakada <nobu@r...> * string.c (rb_str_rstrip_bang): should not sign-expand non-ascii. Index: string.c =================================================================== --- string.c (revision 23159) +++ string.c (revision 23160) @@ -4291,7 +4291,7 @@ result = rb_str_new5(str, 0, len); p = RSTRING_PTR(str); pend = p + RSTRING_LEN(str); - q = RSTRING_PTR(result); qend = q + len; + q = RSTRING_PTR(result); qend = q + len + 1; *q++ = '"'; while (p < pend) { Index: test/ruby/test_m17n.rb =================================================================== --- test/ruby/test_m17n.rb (revision 23159) +++ test/ruby/test_m17n.rb (revision 23160) @@ -241,6 +241,9 @@ u("\xfc"), "\u3042", "ascii", + + "\u3042".encode("UTF-16LE"), + "\u3042".encode("UTF-16BE"), ].each do |str| assert_equal(str, eval(str.dump), "[ruby-dev:33142]") end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/