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_each_byte): should update rbuf_off and rbuf_len for

each iteration.  [ruby-dev:31659][ruby-dev:32192]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-11-09 07:54:39 +00:00
parent 7bfed9613c
commit 1c4e2b11a1
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Fri Nov 9 16:51:42 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (rb_io_each_byte): should update rbuf_off and rbuf_len for
each iteration. [ruby-dev:31659][ruby-dev:32192]
Fri Nov 9 15:52:00 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> Fri Nov 9 15:52:00 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* encoding.c (enc_check_encoding, rb_set_primary_encoding): ENCODING * encoding.c (enc_check_encoding, rb_set_primary_encoding): ENCODING

4
io.c
View file

@ -2022,11 +2022,11 @@ rb_io_each_byte(VALUE io)
p = fptr->rbuf+fptr->rbuf_off; p = fptr->rbuf+fptr->rbuf_off;
e = p + fptr->rbuf_len; e = p + fptr->rbuf_len;
while (p < e) { while (p < e) {
fptr->rbuf_off++;
fptr->rbuf_len--;
rb_yield(INT2FIX(*p & 0xff)); rb_yield(INT2FIX(*p & 0xff));
p++; p++;
} }
fptr->rbuf_off += fptr->rbuf_len;
fptr->rbuf_len = 0;
rb_io_check_readable(fptr); rb_io_check_readable(fptr);
READ_CHECK(fptr); READ_CHECK(fptr);
if (io_fillbuf(fptr) < 0) { if (io_fillbuf(fptr) < 0) {