* 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/trunk@33627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2011-11-03 16:59:53 +00:00
Родитель b2f90f4d51
Коммит 932d63efe0
2 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,11 @@
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.
Fri Nov 4 01:04:48 2011 NARUSE, Yui <naruse@ruby-lang.org>
* ext/readline/readline.c (Init_readline): like r18313, libedit's

4
io.c
Просмотреть файл

@ -910,7 +910,9 @@ 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