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

* io.c (rb_io_getline_fast): wrong calculation of new position

from rb_str_coderange_scan_restartable().  [ruby-core:28103]

* io.c (read_all): ditto.  

* sprintf.c (rb_str_format): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2010-02-08 15:08:15 +00:00
parent 7e833da5fe
commit bba5e1126b
3 changed files with 12 additions and 3 deletions

View file

@ -1,3 +1,12 @@
Mon Feb 8 23:49:24 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (rb_io_getline_fast): wrong calculation of new position
from rb_str_coderange_scan_restartable(). [ruby-core:28103]
* io.c (read_all): ditto.
* sprintf.c (rb_str_format): ditto.
Mon Feb 8 21:03:53 2010 Tanaka Akira <akr@fsij.org>
* ext/socket/socket.c (socket_s_ip_address_list): obtain the scope_id

2
io.c
View file

@ -2287,7 +2287,7 @@ rb_io_getline_fast(rb_io_t *fptr, rb_encoding *enc)
}
len += pending;
if (cr != ENC_CODERANGE_BROKEN)
pos = rb_str_coderange_scan_restartable(RSTRING_PTR(str) + pos, RSTRING_PTR(str) + len, enc, &cr);
pos += rb_str_coderange_scan_restartable(RSTRING_PTR(str) + pos, RSTRING_PTR(str) + len, enc, &cr);
if (e) break;
}
rb_thread_wait_fd(fptr->fd);

View file

@ -483,7 +483,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
for (t = p; t < end && *t != '%'; t++) ;
PUSH(p, t - p);
if (coderange != ENC_CODERANGE_BROKEN && scanned < blen) {
scanned = rb_str_coderange_scan_restartable(buf+scanned, buf+blen, enc, &coderange);
scanned += rb_str_coderange_scan_restartable(buf+scanned, buf+blen, enc, &coderange);
ENC_CODERANGE_SET(result, coderange);
}
if (t >= end) {
@ -672,7 +672,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
rb_str_set_len(result, blen);
if (coderange != ENC_CODERANGE_BROKEN && scanned < blen) {
int cr = coderange;
scanned = rb_str_coderange_scan_restartable(buf+scanned, buf+blen, enc, &cr);
scanned += rb_str_coderange_scan_restartable(buf+scanned, buf+blen, enc, &cr);
ENC_CODERANGE_SET(result,
(cr == ENC_CODERANGE_UNKNOWN ?
ENC_CODERANGE_BROKEN : (coderange = cr)));