зеркало из https://github.com/github/ruby.git
* string.c (rb_enc_cr_str_buf_cat): don't reset coderange as unknown.
the condition 'ptr_a8 && str_cr != ENC_CODERANGE_7BIT' means not unknown, str is also ASCII-8BIT because str_encindex == ptr_encindex, and nont (str_cr == ENC_CODERANGE_UNKNOWN) and str_cr != ENC_CODERANGE_7BIT means str_cr is valid because ASCII-8BIT can't be broken. [ruby-dev:45688] [Bug #6509] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
5f85fcc11f
Коммит
7671e7dd35
|
@ -1,3 +1,12 @@
|
|||
Sat Jun 2 16:59:00 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* string.c (rb_enc_cr_str_buf_cat): don't reset coderange as unknown.
|
||||
the condition 'ptr_a8 && str_cr != ENC_CODERANGE_7BIT' means not
|
||||
unknown, str is also ASCII-8BIT because str_encindex == ptr_encindex,
|
||||
and nont (str_cr == ENC_CODERANGE_UNKNOWN) and
|
||||
str_cr != ENC_CODERANGE_7BIT means str_cr is valid because ASCII-8BIT
|
||||
can't be broken. [ruby-dev:45688] [Bug #6509]
|
||||
|
||||
Sat Jun 2 07:04:48 2012 Eric Hodel <drbrain@segment7.net>
|
||||
|
||||
* doc/re.rdoc (Performance): Replaced incorrect example of reducing
|
||||
|
|
7
string.c
7
string.c
|
@ -1925,10 +1925,11 @@ rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len,
|
|||
str_cr = ENC_CODERANGE(str);
|
||||
|
||||
if (str_encindex == ptr_encindex) {
|
||||
if (str_cr == ENC_CODERANGE_UNKNOWN ||
|
||||
(ptr_a8 && str_cr != ENC_CODERANGE_7BIT)) {
|
||||
if (str_cr == ENC_CODERANGE_UNKNOWN)
|
||||
ptr_cr = ENC_CODERANGE_UNKNOWN;
|
||||
}
|
||||
else if (ptr_a8 && str_cr == ENC_CODERANGE_VALID)
|
||||
/* since str is also ASCII-8BIT, 7bit nor unknown means valid */
|
||||
ptr_cr = ENC_CODERANGE_VALID;
|
||||
else if (ptr_cr == ENC_CODERANGE_UNKNOWN) {
|
||||
ptr_cr = coderange_scan(ptr, len, rb_enc_from_index(ptr_encindex));
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче