diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-30 12:09:24 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-30 12:09:24 +0000 |
| commit | ebe2bc0e0aec2442db3510bd663776de0d893133 (patch) | |
| tree | 9b2317f5e2131dcda7a9b9a4106733a11e2c9b82 /io.c | |
| parent | 8fcdd0157326e73b110737fbd6d0c3a3a60866d8 (diff) | |
| download | ruby-ebe2bc0e0aec2442db3510bd663776de0d893133.tar.gz ruby-ebe2bc0e0aec2442db3510bd663776de0d893133.tar.xz ruby-ebe2bc0e0aec2442db3510bd663776de0d893133.zip | |
merges r20045 from trunk into ruby_1_9_1.
* io.c (rb_io_rewind): should reset fptr->readconv if it's
available.
* io.c (more_char): clear readconv at EOF.
* test/ruby/test_file.rb: should not read after EOF. use rewind
instead.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
| -rw-r--r-- | io.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1057,6 +1057,8 @@ rb_io_set_pos(VALUE io, VALUE offset) return OFFT2NUM(pos); } +static void clear_readconv(rb_io_t *fptr); + /* * call-seq: * ios.rewind => 0 @@ -1082,6 +1084,9 @@ rb_io_rewind(VALUE io) ARGF.gets_lineno -= fptr->lineno; } fptr->lineno = 0; + if (fptr->readconv) { + clear_readconv(fptr); + } return INT2FIX(0); } @@ -1499,8 +1504,10 @@ more_char(rb_io_t *fptr) if (cbuf_len0 != fptr->cbuf_len) return 0; - if (res == econv_finished) + if (res == econv_finished) { + clear_readconv(fptr); return -1; + } if (res == econv_source_buffer_empty) { if (fptr->rbuf_len == 0) { |
