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

Can't use singlebyte optimization when the replacement is multibyte. [ruby-core:24612]

* string.c (tr_trans): can't use singlebyte optimization when
          the replacement is multibyte. [ruby-core:24612]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2009-07-31 20:36:04 +00:00
parent 971f2bb769
commit c4641d6a00
2 changed files with 7 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Sat Aug 1 05:18:36 2009 NARUSE, Yui <naruse@ruby-lang.org>
* string.c (tr_trans): can't use singlebyte optimization when
the replacement is multibyte. [ruby-core:24612]
Fri Jul 31 18:01:34 2009 NAKAMURA Usaku <usa@ruby-lang.org>
* lib/securerandom.rb (SecureRandom.random_bytes): return string should

View file

@ -4871,7 +4871,8 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
if (r == errc) r = trrepl.now;
if (c < 256) {
trans[c] = r;
if (r > 255) singlebyte = 0;
if (r > 255 || (r > 127 && rb_enc_mbmaxlen(enc) != 1))
singlebyte = 0;
}
else {
if (!hash) hash = rb_hash_new();