From 1c4e2b11a1f5fc00d727809225d089b7990ed979 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 9 Nov 2007 07:54:39 +0000 Subject: * 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 --- io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index ded34f07de..1754224af9 100644 --- a/io.c +++ b/io.c @@ -2022,11 +2022,11 @@ rb_io_each_byte(VALUE io) p = fptr->rbuf+fptr->rbuf_off; e = p + fptr->rbuf_len; while (p < e) { + fptr->rbuf_off++; + fptr->rbuf_len--; rb_yield(INT2FIX(*p & 0xff)); p++; } - fptr->rbuf_off += fptr->rbuf_len; - fptr->rbuf_len = 0; rb_io_check_readable(fptr); READ_CHECK(fptr); if (io_fillbuf(fptr) < 0) { -- cgit v1.2.1