summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-17 13:01:52 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-17 13:01:52 +0000
commit8dd8dfce21d9ac6c7d791a9d95a11e6f7839d545 (patch)
tree3961b89549c90662c8eb531950eacf2dbdc0698b /string.c
parentb8fd2fabbef7696b42e2802caf1daf1368cc099e (diff)
* encoding.c (ENC_CODERANGE_AND): fix broken case. [ruby-dev:33826]
* string.c (rb_str_times): fix broken case. [ruby-dev:33826] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/string.c b/string.c
index c240f0ec75..6177059738 100644
--- a/string.c
+++ b/string.c
@@ -758,6 +758,7 @@ rb_str_times(VALUE str, VALUE times)
{
VALUE str2;
long n, len;
+ int cr;
len = NUM2LONG(times);
if (len < 0) {
@@ -779,7 +780,9 @@ rb_str_times(VALUE str, VALUE times)
}
RSTRING_PTR(str2)[RSTRING_LEN(str2)] = '\0';
OBJ_INFECT(str2, str);
- ENCODING_CODERANGE_SET(str2, rb_enc_get_index(str), ENC_CODERANGE(str));
+ cr = ENC_CODERANGE(str);
+ if (cr == ENC_CODERANGE_BROKEN) cr = ENC_CODERANGE_UNKNOWN;
+ ENCODING_CODERANGE_SET(str2, rb_enc_get_index(str), cr);
return str2;
}