mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (tr_trans): wrong condition for mbmaxlen==1 strings.
[ruby-dev:31652] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1a0b7d0fb6
commit
fa02a6cedd
2 changed files with 10 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Mon Aug 27 13:11:56 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (tr_trans): wrong condition for mbmaxlen==1 strings.
|
||||||
|
[ruby-dev:31652]
|
||||||
|
|
||||||
Mon Aug 27 00:41:13 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Mon Aug 27 00:41:13 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* io.c (rb_io_each_byte): caused infinite loop. [ruby-dev:31652]
|
* io.c (rb_io_each_byte): caused infinite loop. [ruby-dev:31652]
|
||||||
|
|
9
string.c
9
string.c
|
@ -3264,13 +3264,14 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
|
||||||
while (s < send) {
|
while (s < send) {
|
||||||
VALUE v = rb_hash_aref(hash, INT2FIX(*s));
|
VALUE v = rb_hash_aref(hash, INT2FIX(*s));
|
||||||
if (!NIL_P(v)) {
|
if (!NIL_P(v)) {
|
||||||
if (cflag) {
|
if (!cflag) {
|
||||||
*s = last;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
c = FIX2INT(v);
|
c = FIX2INT(v);
|
||||||
*s = c & 0xff;
|
*s = c & 0xff;
|
||||||
|
modify = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (cflag) {
|
||||||
|
*s = last;
|
||||||
modify = 1;
|
modify = 1;
|
||||||
}
|
}
|
||||||
s++;
|
s++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue