diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-16 15:25:25 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-10-16 15:25:25 +0000 |
commit | 0cda4bb3bf099874662a10d1e66522369812716e (patch) | |
tree | c590d4345b28751356a7ff363dd834f2a42a175d /io.c | |
parent | f560dfdd9020e05cfbc7984217c4c63738b5fdf2 (diff) |
* io.c (rb_io_binmode): reset encoding conversion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19807 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -3503,13 +3503,24 @@ rb_io_binmode(VALUE io) rb_io_t *fptr; GetOpenFile(io, fptr); - if (fptr->readconv) - rb_econv_binmode(fptr->readconv); - if (fptr->writeconv) - rb_econv_binmode(fptr->writeconv); + + if (fptr->readconv) { + rb_econv_close(fptr->readconv); + fptr->readconv = NULL; + } + if (fptr->writeconv) { + rb_econv_close(fptr->writeconv); + fptr->writeconv = NULL; + } fptr->mode |= FMODE_BINMODE; fptr->mode &= ~FMODE_TEXTMODE; - fptr->writeconv_pre_ecflags &= ~(ECONV_UNIVERSAL_NEWLINE_DECORATOR|ECONV_CRLF_NEWLINE_DECORATOR|ECONV_CR_NEWLINE_DECORATOR); + + fptr->encs.enc = rb_ascii8bit_encoding(); + fptr->encs.enc2 = NULL; + fptr->encs.ecflags = 0; + fptr->encs.ecopts = Qnil; + clear_codeconv(fptr); + return io; } |