mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (read_all): don't call io_shift_cbuf until bufffering enough or
econv_finished. [ruby-dev:39696] * io.c (more_char): don't call clear_readconv to read buffer after econv_finished. * io.c (appendline, rb_io_each_codepoint): clear readconv when done. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5f221c31ed
commit
d8a754cc12
2 changed files with 17 additions and 2 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Mon Nov 16 07:59:38 2009 wanabe <s.wanabe@gmail.com>
|
||||
|
||||
* io.c (read_all): don't call io_shift_cbuf until bufffering enough or
|
||||
econv_finished. [ruby-dev:39696]
|
||||
|
||||
* io.c (more_char): don't call clear_readconv to read buffer after
|
||||
econv_finished.
|
||||
|
||||
* io.c (appendline, rb_io_each_codepoint): clear readconv when done.
|
||||
|
||||
Mon Nov 16 01:58:08 2009 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* include/ruby/ruby.h (rb_classext_t): annotate @internal.
|
||||
|
|
9
io.c
9
io.c
|
@ -1625,7 +1625,6 @@ more_char(rb_io_t *fptr)
|
|||
return 0;
|
||||
|
||||
if (res == econv_finished) {
|
||||
clear_readconv(fptr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1687,10 +1686,14 @@ read_all(rb_io_t *fptr, long siz, VALUE str)
|
|||
else rb_str_set_len(str, 0);
|
||||
make_readconv(fptr, 0);
|
||||
while (1) {
|
||||
if (fptr->cbuf_len) {
|
||||
if (fptr->cbuf_len > fptr->cbuf_capa / 2) {
|
||||
io_shift_cbuf(fptr, fptr->cbuf_len, &str);
|
||||
}
|
||||
if (more_char(fptr) == -1) {
|
||||
if (fptr->cbuf_len) {
|
||||
io_shift_cbuf(fptr, fptr->cbuf_len, &str);
|
||||
}
|
||||
clear_readconv(fptr);
|
||||
return io_enc_str(str, fptr);
|
||||
}
|
||||
}
|
||||
|
@ -2172,6 +2175,7 @@ appendline(rb_io_t *fptr, int delim, VALUE *strp, long *lp)
|
|||
}
|
||||
}
|
||||
} while (more_char(fptr) != -1);
|
||||
clear_readconv(fptr);
|
||||
*lp = limit;
|
||||
return EOF;
|
||||
}
|
||||
|
@ -2820,6 +2824,7 @@ rb_io_each_codepoint(VALUE io)
|
|||
}
|
||||
}
|
||||
if (more_char(fptr) == -1) {
|
||||
clear_readconv(fptr);
|
||||
/* ignore an incomplete character before EOF */
|
||||
return io;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue