зеркало из https://github.com/github/ruby.git
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
6387c5dc8c
Коммит
a5596dc6a3
|
@ -1,3 +1,10 @@
|
|||
Wed Apr 8 21:58:12 2009 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_rstrip_bang): should not sign-expand non-ascii.
|
||||
|
|
2
string.c
2
string.c
|
@ -4291,7 +4291,7 @@ rb_str_dump(VALUE str)
|
|||
|
||||
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) {
|
||||
|
|
|
@ -241,6 +241,9 @@ class TestM17N < Test::Unit::TestCase
|
|||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче