summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-07 16:33:51 +0000
committertarui <tarui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-07 16:33:51 +0000
commitdc08e762fc66c86e14d22ebd2a4253fe59ba39d0 (patch)
treea36f2c15eb13fe89af78961051e2a9a80dd35574
parent520ab49712a3cb5e4f8a3259bd52d87e060669d4 (diff)
* io.c (make_writeconv): unversal_newline converter is for reading.
so, if the io is text mode and has ECONV_UNIVERSAL_NEWLINE_DECORATOR flag, use crlf_newline converter for writing. this change fixes the problem about the luck of CR up Kernel.p and Kernel.puts to stdout/stderr on Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog10
-rw-r--r--io.c5
2 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 530aa34696..be6743c7f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,14 @@
+Fri Nov 4 01:56:30 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (make_writeconv): unversal_newline converter is for reading.
+ so, if the io is text mode and has ECONV_UNIVERSAL_NEWLINE_DECORATOR
+ flag, use crlf_newline converter for writing.
+ this change fixes the problem about the luck of CR up Kernel.p and
+ Kernel.puts to stdout/stderr on Windows.
+
Mon Nov 7 23:39:23 2011 Tajima Akio <artonx@yahoo.co.jp>
- * io.c (io_fflush): remove fsync().
+ * io.c (io_fflush): remove fsync().
* io.c (rb_io_flush, rb_io_rewind): fsync() here.
These pathces are backports of trunk r33651 for [Bug #5585]
diff --git a/io.c b/io.c
index c8f941b065..d13ba93edd 100644
--- a/io.c
+++ b/io.c
@@ -754,8 +754,11 @@ make_writeconv(rb_io_t *fptr)
ecopts = fptr->encs.ecopts;
#ifdef TEXTMODE_NEWLINE_DECORATOR_ON_WRITE
if (NEED_NEWLINE_DECORATOR_ON_WRITE(fptr) &&
- !(ecflags & ECONV_NEWLINE_DECORATOR_MASK))
+ (!(ecflags & ECONV_NEWLINE_DECORATOR_MASK) ||
+ (ecflags & ECONV_UNIVERSAL_NEWLINE_DECORATOR))) {
+ ecflags &= ~ECONV_UNIVERSAL_NEWLINE_DECORATOR;
ecflags |= TEXTMODE_NEWLINE_DECORATOR_ON_WRITE;
+ }
#endif
if (!fptr->encs.enc || (fptr->encs.enc == rb_ascii8bit_encoding() && !fptr->encs.enc2)) {