Project

General

Profile

Actions

Bug #689

closed

reading after EOF with textmode

Added by usa (Usaku NAKAMURA) over 15 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
Backport:
[ruby-dev:36977]

Description

=begin
こんにちは、なかむら(う)です。

テキストモード時に一度EOFに到達すると、rewindやseekでポインタ
を移動するとか新しいデータが到達するとかしても、EOF状態から脱
出できないようです。
more_char()でEOFを検知した時点でreadconvをリセットする必要が
あるように思えるのですが、そういう理解で正しいでしょうか?

Index: io.c

--- io.c (revision 19991)
+++ io.c (working copy)
@@ -1457,6 +1457,8 @@ make_readconv(rb_io_t *fptr)
}
}

+static void clear_readconv(rb_io_t *fptr);
+
static int
more_char(rb_io_t *fptr)
{
@@ -1499,8 +1501,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) {
    


それでは。

U.Nakamura
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0