From 7d48eab26035ea6ef10c14dcb3a01475ad861065 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 20 Oct 2008 15:53:14 +0000 Subject: * io.c (rb_io_ascii8bit_binmode): renamed from rb_io_binmode. (rb_io_binmode): don't change encoding conversion. (rb_io_binmode_m): call rb_io_ascii8bit_binmode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ io.c | 19 +++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef3d53235e..5089ad3ef5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Oct 21 00:51:59 2008 Tanaka Akira + + * io.c (rb_io_ascii8bit_binmode): renamed from rb_io_binmode. + (rb_io_binmode): don't change encoding conversion. + (rb_io_binmode_m): call rb_io_ascii8bit_binmode. + Mon Oct 20 21:19:00 2008 Takeyuki FUJIOKA * lib/cgi/core.rb (read_multipart): file's encoding is ascii-8bit diff --git a/io.c b/io.c index 32b8a7b3c1..3795fb76dc 100644 --- a/io.c +++ b/io.c @@ -3503,7 +3503,22 @@ 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); + fptr->mode |= FMODE_BINMODE; + fptr->mode &= ~FMODE_TEXTMODE; + fptr->writeconv_pre_ecflags &= ~(ECONV_UNIVERSAL_NEWLINE_DECORATOR|ECONV_CRLF_NEWLINE_DECORATOR|ECONV_CR_NEWLINE_DECORATOR); + return io; +} +static VALUE +rb_io_ascii8bit_binmode(VALUE io) +{ + rb_io_t *fptr; + + GetOpenFile(io, fptr); if (fptr->readconv) { rb_econv_close(fptr->readconv); fptr->readconv = NULL; @@ -3542,11 +3557,11 @@ rb_io_binmode_m(VALUE io) { VALUE write_io; - rb_io_binmode(io); + rb_io_ascii8bit_binmode(io); write_io = GetWriteIO(io); if (write_io != io) - rb_io_binmode(write_io); + rb_io_ascii8bit_binmode(write_io); return io; } -- cgit v1.2.3