summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-16 15:25:25 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-16 15:25:25 +0000
commit0cda4bb3bf099874662a10d1e66522369812716e (patch)
treec590d4345b28751356a7ff363dd834f2a42a175d /io.c
parentf560dfdd9020e05cfbc7984217c4c63738b5fdf2 (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.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/io.c b/io.c
index 89d8e7fc6f..76b6f8771e 100644
--- a/io.c
+++ b/io.c
@@ -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;
}