summaryrefslogtreecommitdiffstats
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
commit69b20b190e5c1dca1a2d351c4d46c550c45b0610 (patch)
treec590d4345b28751356a7ff363dd834f2a42a175d /io.c
parent260afd3c1a0386b5ac2333f59b5e97a5c24feb49 (diff)
downloadruby-69b20b190e5c1dca1a2d351c4d46c550c45b0610.tar.gz
ruby-69b20b190e5c1dca1a2d351c4d46c550c45b0610.tar.xz
ruby-69b20b190e5c1dca1a2d351c4d46c550c45b0610.zip
* io.c (rb_io_binmode): reset encoding conversion.
git-svn-id: http://svn.ruby-lang.org/repos/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 89d8e7fc6..76b6f8771 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;
}