From 925cc8ffd010df19a044875df252e939eaf0a8da Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 14 Apr 2014 05:33:40 +0000 Subject: [PATCH] string.c: keep source code range * string.c (rb_enc_cr_str_buf_cat): keep code range of the source string even if code range of the destination string is unknown. no reason to the former is affected by the latter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/string.c b/string.c index 28b1efa2e9..227424d266 100644 --- a/string.c +++ b/string.c @@ -2090,9 +2090,7 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len, str_cr = RSTRING_LEN(str) ? ENC_CODERANGE(str) : ENC_CODERANGE_7BIT; if (str_encindex == ptr_encindex) { - if (str_cr == ENC_CODERANGE_UNKNOWN) - ptr_cr = ENC_CODERANGE_UNKNOWN; - else if (ptr_cr == ENC_CODERANGE_UNKNOWN) { + if (str_cr != ENC_CODERANGE_UNKNOWN && ptr_cr == ENC_CODERANGE_UNKNOWN) { ptr_cr = coderange_scan(ptr, len, rb_enc_from_index(ptr_encindex)); } }