diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | io.c | 19 |
2 files changed, 23 insertions, 2 deletions
@@ -1,3 +1,9 @@ +Tue Oct 21 00:51:59 2008 Tanaka Akira <akr@fsij.org> + + * 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 <xibbar@ruby-lang.org> * lib/cgi/core.rb (read_multipart): file's encoding is ascii-8bit @@ -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; } |