1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* string.c (rb_enc_cr_str_copy): check string's coderange is 7bit or

valid.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2008-02-22 12:15:56 +00:00
parent bc2fb51c5e
commit bdb14b5bb6
2 changed files with 16 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Fri Feb 22 21:12:42 2008 NARUSE, Yui <naruse@ruby-lang.org>
* string.c (rb_enc_cr_str_copy): check string's coderange is 7bit or
valid.
Fri Feb 22 19:50:19 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* bignum.c (BIGZEROP): fix for longer Bignum zeros. [ruby-Bugs-17454]

View file

@ -215,8 +215,17 @@ void
rb_enc_cr_str_copy(VALUE dest, VALUE src)
{
rb_enc_copy(dest, src);
if (!is_broken_string(src))
ENC_CODERANGE_SET(dest, ENC_CODERANGE(src));
switch (ENC_CODERANGE(src)) {
case ENC_CODERANGE_7BIT:
ENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT);
break;
case ENC_CODERANGE_VALID:
if (search_nonascii(RSTRING_PTR(dest), RSTRING_END(dest)))
ENC_CODERANGE_SET(dest, ENC_CODERANGE_VALID);
else
ENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT);
break;
}
}
void