зеркало из https://github.com/github/ruby.git
* encoding.c (rb_enc_compatible): ASCII compatible string and US-ASCII
regexp is compatible. [ruby-dev:36033] * string.c (rb_str_index_m): second argument is position of character. by usa. [ruby-dev:36033] * string.c (rb_str_rindex_m): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
d2d37173e7
Коммит
7fc16c2377
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Fri Aug 29 11:04:03 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* encoding.c (rb_enc_compatible): ASCII compatible string and US-ASCII
|
||||
regexp is compatible. [ruby-dev:36033]
|
||||
|
||||
* string.c (rb_str_index_m): second argument is position of character.
|
||||
by usa. [ruby-dev:36033]
|
||||
|
||||
* string.c (rb_str_rindex_m): ditto.
|
||||
|
||||
Fri Aug 29 04:47:49 2008 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* win32/win32.c (rb_w32_read, rb_w32_write): more accurate handling
|
||||
|
|
|
@ -631,6 +631,10 @@ rb_enc_compatible(VALUE str1, VALUE str2)
|
|||
if (!rb_enc_asciicompat(enc1) || !rb_enc_asciicompat(enc2)) {
|
||||
return 0;
|
||||
}
|
||||
if (BUILTIN_TYPE(str2) == T_REGEXP && idx2 == ENCINDEX_US_ASCII)
|
||||
return enc1;
|
||||
if (BUILTIN_TYPE(str1) == T_REGEXP && idx1 == ENCINDEX_US_ASCII)
|
||||
return enc2;
|
||||
|
||||
if (BUILTIN_TYPE(str1) != T_STRING) {
|
||||
VALUE tmp = str1;
|
||||
|
@ -652,7 +656,7 @@ rb_enc_compatible(VALUE str1, VALUE str2)
|
|||
if (cr2 == ENC_CODERANGE_7BIT) return enc1;
|
||||
}
|
||||
if (cr2 == ENC_CODERANGE_7BIT) {
|
||||
if (idx1 == 0) return enc2;
|
||||
if (idx1 == ENCINDEX_ASCII) return enc2;
|
||||
return enc1;
|
||||
}
|
||||
}
|
||||
|
|
6
string.c
6
string.c
|
@ -2167,6 +2167,9 @@ rb_str_index_m(int argc, VALUE *argv, VALUE str)
|
|||
}
|
||||
}
|
||||
|
||||
pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos,
|
||||
rb_enc_check(str, sub), single_byte_optimizable(str));
|
||||
|
||||
switch (TYPE(sub)) {
|
||||
case T_REGEXP:
|
||||
pos = rb_reg_adjust_startpos(sub, str, pos, 0);
|
||||
|
@ -2277,6 +2280,9 @@ rb_str_rindex_m(int argc, VALUE *argv, VALUE str)
|
|||
pos = len;
|
||||
}
|
||||
|
||||
pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos,
|
||||
rb_enc_check(str, sub), single_byte_optimizable(str));
|
||||
|
||||
switch (TYPE(sub)) {
|
||||
case T_REGEXP:
|
||||
/* enc = rb_get_check(str, sub); */
|
||||
|
|
Загрузка…
Ссылка в новой задаче