aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-27 04:51:45 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-08-27 04:51:45 +0000
commitfa02a6ceddfee03f7e68ef217f32e72ce44f7a1c (patch)
tree637b212b714c75283e2b4581a5ceb2091ef93fc9
parent1a0b7d0fb6e05704c94d7916aebbaca7c288a86f (diff)
downloadruby-fa02a6ceddfee03f7e68ef217f32e72ce44f7a1c.tar.gz
* 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
-rw-r--r--ChangeLog5
-rw-r--r--string.c9
2 files changed, 10 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 11f0f832c3..aa6f782e52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* io.c (rb_io_each_byte): caused infinite loop. [ruby-dev:31652]
diff --git a/string.c b/string.c
index 26ae87a25e..11c80d4618 100644
--- a/string.c
+++ b/string.c
@@ -3264,13 +3264,14 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
while (s < send) {
VALUE v = rb_hash_aref(hash, INT2FIX(*s));
if (!NIL_P(v)) {
- if (cflag) {
- *s = last;
- }
- else {
+ if (!cflag) {
c = FIX2INT(v);
*s = c & 0xff;
+ modify = 1;
}
+ }
+ else if (cflag) {
+ *s = last;
modify = 1;
}
s++;