diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-21 06:37:18 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-21 06:37:18 +0000 |
commit | 4131d6176ac46da95b1e7fa045651783f0a66c65 (patch) | |
tree | 183d949381d2319ad4fe8471f2632f8e86839ca2 /io.c | |
parent | 2976ec58a48e3ff83ff3d0979041bb5694592153 (diff) | |
download | ruby-4131d6176ac46da95b1e7fa045651783f0a66c65.tar.gz |
* io.c (io_getc): fix incomplete character immediately before EOF
with newline converter. [ruby-dev:41024]
run test only when "Create Shortcut (&S)" menu is found.
* lib/rexml/parsers/xpathparser.rb (PathExpr): ditto.
* lib/matrix.rb (Vector#each): make Vector enumerable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -2756,15 +2756,15 @@ io_getc(rb_io_t *fptr, rb_encoding *enc) } if (more_char(fptr) == MORE_CHAR_FINISHED) { - clear_readconv(fptr); - if (fptr->cbuf_len == 0) - return Qnil; + if (fptr->cbuf_len == 0) { + clear_readconv(fptr); + return Qnil; + } /* return an unit of an incomplete character just before EOF */ - r = rb_enc_mbclen(fptr->cbuf+fptr->cbuf_off, - fptr->cbuf+fptr->cbuf_off+fptr->cbuf_len, - read_enc); - io_shift_cbuf(fptr, r, &str); - str = io_enc_str(str, fptr); + str = rb_enc_str_new(fptr->cbuf+fptr->cbuf_off, 1, read_enc); + fptr->cbuf_off += 1; + fptr->cbuf_len -= 1; + if (fptr->cbuf_len == 0) clear_readconv(fptr); ENC_CODERANGE_SET(str, ENC_CODERANGE_BROKEN); return str; } |