mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 13:04:13 +02:00
* include/ruby/oniguruma.h (OnigEncodingTypeST): add end argument for
left_adjust_char_head. (ONIGENC_LEFT_ADJUST_CHAR_HEAD): add end argument. (onigenc_get_left_adjust_char_head): ditto. * include/ruby/encoding.h (rb_enc_left_char_head): add end argument. * regenc.h (onigenc_single_byte_left_adjust_char_head): ditto. * regenc.c (onigenc_get_right_adjust_char_head): follow the interface change. (onigenc_get_right_adjust_char_head_with_prev): ditto. (onigenc_get_prev_char_head): ditto. (onigenc_step_back): ditto. (onigenc_get_left_adjust_char_head): ditto. (onigenc_single_byte_code_to_mbc): ditto. * re.c: ditto. * string.c: ditto. * io.c: ditto. * regexec.c: ditto. * enc/euc_jp.c: ditto. * enc/cp949.c: ditto. * enc/shift_jis.c: ditto. * enc/gbk.c: ditto. * enc/big5.c: ditto. * enc/euc_tw.c: ditto. * enc/euc_kr.c: ditto. * enc/emacs_mule.c: ditto. * enc/gb18030.c: ditto. * enc/utf_8.c: ditto. * enc/utf_16le.c: ditto. * enc/utf_16be.c: ditto. * enc/utf_32le.c: ditto. * enc/utf_32be.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
10ff0f292e
commit
19416601a0
23 changed files with 110 additions and 52 deletions
9
io.c
9
io.c
|
@ -2177,13 +2177,14 @@ rb_io_getline_1(VALUE rs, long limit, VALUE io)
|
|||
else
|
||||
enc = io_input_encoding(fptr);
|
||||
while ((c = appendline(fptr, newline, &str, &limit)) != EOF) {
|
||||
const char *s, *p, *pp;
|
||||
const char *s, *p, *pp, *e;
|
||||
|
||||
if (c == newline) {
|
||||
if (RSTRING_LEN(str) < rslen) continue;
|
||||
s = RSTRING_PTR(str);
|
||||
p = s + RSTRING_LEN(str) - rslen;
|
||||
pp = rb_enc_left_char_head(s, p, enc);
|
||||
e = s + RSTRING_LEN(str);
|
||||
p = e - rslen;
|
||||
pp = rb_enc_left_char_head(s, p, e, enc);
|
||||
if (pp != p) continue;
|
||||
if (!rspara) rscheck(rsptr, rslen, rs);
|
||||
if (memcmp(p, rsptr, rslen) == 0) break;
|
||||
|
@ -2191,7 +2192,7 @@ rb_io_getline_1(VALUE rs, long limit, VALUE io)
|
|||
if (limit == 0) {
|
||||
s = RSTRING_PTR(str);
|
||||
p = s + RSTRING_LEN(str);
|
||||
pp = rb_enc_left_char_head(s, p-1, enc);
|
||||
pp = rb_enc_left_char_head(s, p-1, p, enc);
|
||||
if (extra_limit &&
|
||||
MBCLEN_NEEDMORE_P(rb_enc_precise_mbclen(pp, p, enc))) {
|
||||
/* relax the limit while incomplete character.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue