ruby-changes:21116
From: nobu <ko1@a...>
Date: Fri, 2 Sep 2011 21:11:31 +0900 (JST)
Subject: [ruby-changes:21116] nobu:r33165 (trunk, ruby_1_9_3): * io.c (validate_enc_binmode, prep_stdio): default to text mode on
nobu 2011-09-02 21:11:17 +0900 (Fri, 02 Sep 2011) New Revision: 33165 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33165 Log: * io.c (validate_enc_binmode, prep_stdio): default to text mode on dosish platforms. [ruby-core:38822] [Bug #5164] * transcode.c (rb_econv_prepare_options): keep default ecflags unchanged if no options. Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/io.c branches/ruby_1_9_3/transcode.c trunk/ChangeLog trunk/io.c trunk/transcode.c Index: ChangeLog =================================================================== --- ChangeLog (revision 33164) +++ ChangeLog (revision 33165) @@ -1,3 +1,11 @@ +Fri Sep 2 21:11:16 2011 Nobuyoshi Nakada <nobu@r...> + + * io.c (validate_enc_binmode, prep_stdio): default to text mode on + dosish platforms. [ruby-core:38822] [Bug #5164] + + * transcode.c (rb_econv_prepare_options): keep default ecflags + unchanged if no options. + Fri Sep 2 14:36:47 2011 Nobuyoshi Nakada <nobu@r...> * vm_insnhelper.c (vm_search_const_defined_class): search Index: io.c =================================================================== --- io.c (revision 33164) +++ io.c (revision 33165) @@ -4435,7 +4435,7 @@ rb_raise(rb_eArgError, "ASCII incompatible encoding needs binmode"); if (!(fmode & FMODE_BINMODE) && - (ecflags & ECONV_NEWLINE_DECORATOR_MASK)) { + (DEFAULT_TEXTMODE || (ecflags & ECONV_NEWLINE_DECORATOR_MASK))) { fmode |= DEFAULT_TEXTMODE; *fmode_p = fmode; } @@ -6412,9 +6412,10 @@ prep_stdio(FILE *f, int fmode, VALUE klass, const char *path) { rb_io_t *fptr; - VALUE io = prep_io(fileno(f), fmode|FMODE_PREP, klass, path); + VALUE io = prep_io(fileno(f), fmode|FMODE_PREP|DEFAULT_TEXTMODE, klass, path); GetOpenFile(io, fptr); + fptr->encs.ecflags |= ECONV_DEFAULT_NEWLINE_DECORATOR; fptr->stdio_file = f; return io; Index: transcode.c =================================================================== --- transcode.c (revision 33164) +++ transcode.c (revision 33165) @@ -2533,7 +2533,7 @@ if (NIL_P(opthash)) { *opts = Qnil; - return 0; + return ecflags; } ecflags = econv_opts(opthash, ecflags); Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 33164) +++ ruby_1_9_3/ChangeLog (revision 33165) @@ -1,3 +1,11 @@ +Fri Sep 2 21:11:16 2011 Nobuyoshi Nakada <nobu@r...> + + * io.c (validate_enc_binmode, prep_stdio): default to text mode on + dosish platforms. [ruby-core:38822] [Bug #5164] + + * transcode.c (rb_econv_prepare_options): keep default ecflags + unchanged if no options. + Fri Sep 2 14:36:47 2011 Nobuyoshi Nakada <nobu@r...> * vm_insnhelper.c (vm_search_const_defined_class): search Index: ruby_1_9_3/io.c =================================================================== --- ruby_1_9_3/io.c (revision 33164) +++ ruby_1_9_3/io.c (revision 33165) @@ -4440,7 +4440,7 @@ rb_raise(rb_eArgError, "ASCII incompatible encoding needs binmode"); if (!(fmode & FMODE_BINMODE) && - (ecflags & ECONV_NEWLINE_DECORATOR_MASK)) { + (DEFAULT_TEXTMODE || (ecflags & ECONV_NEWLINE_DECORATOR_MASK))) { fmode |= DEFAULT_TEXTMODE; *fmode_p = fmode; } @@ -6409,9 +6409,10 @@ prep_stdio(FILE *f, int fmode, VALUE klass, const char *path) { rb_io_t *fptr; - VALUE io = prep_io(fileno(f), fmode|FMODE_PREP, klass, path); + VALUE io = prep_io(fileno(f), fmode|FMODE_PREP|DEFAULT_TEXTMODE, klass, path); GetOpenFile(io, fptr); + fptr->encs.ecflags |= ECONV_DEFAULT_NEWLINE_DECORATOR; fptr->stdio_file = f; return io; Index: ruby_1_9_3/transcode.c =================================================================== --- ruby_1_9_3/transcode.c (revision 33164) +++ ruby_1_9_3/transcode.c (revision 33165) @@ -2533,7 +2533,7 @@ if (NIL_P(opthash)) { *opts = Qnil; - return 0; + return ecflags; } ecflags = econv_opts(opthash, ecflags); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/