Skip to content

Commit

Permalink
* io.c (read_all): fix: false negative invalid byte seequence
Browse files Browse the repository at this point in the history
  on reading from pipes. [ruby-dev:39743]
  fix: assigin the variable 'pos' as relative value from recent pos.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nurse committed Nov 21, 2009
1 parent 10aaddb commit 8f05568
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Sat Nov 21 15:58:43 2009 NARUSE, Yui <[email protected]>

* io.c (read_all): fix: false negative invalid byte seequence
on reading from pipes. [ruby-dev:39743]
fix: assigin the variable 'pos' as relative value from recent pos.

Sat Nov 21 14:44:16 2009 NARUSE, Yui <[email protected]>

* file.c (file_path_convert): delay getting UTF8-MAC encoding
Expand Down
2 changes: 1 addition & 1 deletion io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,7 @@ read_all(rb_io_t *fptr, long siz, VALUE str)
}
bytes += n;
if (cr != ENC_CODERANGE_BROKEN)
pos = rb_str_coderange_scan_restartable(RSTRING_PTR(str) + pos, RSTRING_PTR(str) + bytes, enc, &cr);
pos += rb_str_coderange_scan_restartable(RSTRING_PTR(str) + pos, RSTRING_PTR(str) + bytes, enc, &cr);
if (bytes < siz) break;
siz += BUFSIZ;
rb_str_resize(str, siz);
Expand Down
6 changes: 6 additions & 0 deletions test/ruby/test_io_m17n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,12 @@ def test_pipe
assert_equal(eucjp, r.read)
}

with_pipe("UTF-8") {|r,w|
w << "a" * 1023 + "\u3042" + "a" * 1022
w.close
assert_equal(true, r.read.valid_encoding?)
}

with_pipe("UTF-8:EUC-JP") {|r,w|
assert_equal(Encoding::UTF_8, r.external_encoding)
assert_equal(Encoding::EUC_JP, r.internal_encoding)
Expand Down

0 comments on commit 8f05568

Please sign in to comment.