Project

General

Profile

Feature #2372 ยป buffering_readall.patch

wanabe (_ wanabe), 11/15/2009 09:21 PM

View differences:

io.c (working copy)
1625 1625
            return 0;
1626 1626

  
1627 1627
        if (res == econv_finished) {
1628
	    clear_readconv(fptr);
1629 1628
            return -1;
1630 1629
	}
1631 1630

  
......
1687 1686
        else rb_str_set_len(str, 0);
1688 1687
        make_readconv(fptr, 0);
1689 1688
        while (1) {
1690
            if (fptr->cbuf_len) {
1689
            if (fptr->cbuf_len > fptr->cbuf_capa/2) {
1691 1690
                io_shift_cbuf(fptr, fptr->cbuf_len, &str);
1692 1691
            }
1693 1692
            if (more_char(fptr) == -1) {
1693
		if (fptr->cbuf_len) {
1694
		    io_shift_cbuf(fptr, fptr->cbuf_len, &str);
1695
		}
1696
		clear_readconv(fptr);
1694 1697
                return io_enc_str(str, fptr);
1695 1698
            }
1696 1699
        }
......
2172 2175
                }
2173 2176
            }
2174 2177
        } while (more_char(fptr) != -1);
2178
        clear_readconv(fptr);
2175 2179
        *lp = limit;
2176 2180
        return EOF;
2177 2181
    }
......
2820 2824
		    }
2821 2825
		}
2822 2826
		if (more_char(fptr) == -1) {
2827
		    clear_readconv(fptr);
2823 2828
		    /* ignore an incomplete character before EOF */
2824 2829
		    return io;
2825 2830
		}