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
This commit is contained in:
nobu 2014-04-14 05:33:40 +00:00
parent 9aa67e267b
commit 925cc8ffd0

View File

@ -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));
}
}