diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-14 19:41:32 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-14 19:41:32 +0000 |
commit | 32ed00ab188cf46d0d4bae116a48dac91731af32 (patch) | |
tree | f9e7dc3edc0e4ac9e6890ddae690c0f720a53437 /io.c | |
parent | ad130d3670bc9ef423ccf93c2b6988f988359b29 (diff) |
* io.c (rb_io_each_codepoint): read directly when readconv is
needed but internal encoding is not set. [ruby-core:28650]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -2895,9 +2895,14 @@ rb_io_each_codepoint(VALUE io) rb_enc_name(fptr->encs.enc)); } n = MBCLEN_CHARFOUND_LEN(r); - c = rb_enc_codepoint(fptr->cbuf+fptr->cbuf_off, - fptr->cbuf+fptr->cbuf_off+fptr->cbuf_len, - fptr->encs.enc); + if (fptr->encs.enc) { + c = rb_enc_codepoint(fptr->cbuf+fptr->cbuf_off, + fptr->cbuf+fptr->cbuf_off+fptr->cbuf_len, + fptr->encs.enc); + } + else { + c = (unsigned char)fptr->cbuf[fptr->cbuf_off]; + } fptr->cbuf_off += n; fptr->cbuf_len -= n; rb_yield(UINT2NUM(c)); |