[前][次][番号順一覧][スレッド一覧]

ruby-changes:7340

From: akr <ko1@a...>
Date: Tue, 26 Aug 2008 03:09:36 +0900 (JST)
Subject: [ruby-changes:7340] Ruby:r18859 (trunk): * io.c (make_writeconv): copy invalid/undef flags.

akr	2008-08-26 03:08:08 +0900 (Tue, 26 Aug 2008)

  New Revision: 18859

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18859

  Log:
    * io.c (make_writeconv): copy invalid/undef flags.

  Modified files:
    trunk/ChangeLog
    trunk/io.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 18858)
+++ ChangeLog	(revision 18859)
@@ -1,3 +1,7 @@
+Tue Aug 26 03:06:48 2008  Tanaka Akira  <akr@f...>
+
+	* io.c (make_writeconv): copy invalid/undef flags.
+
 Tue Aug 26 02:47:08 2008  Yuki Sonoda (Yugui)  <yugui@y...>
 
 	* common.mk (dist): tool/make-snapshot is executable.
Index: io.c
===================================================================
--- io.c	(revision 18858)
+++ io.c	(revision 18859)
@@ -696,21 +696,24 @@
 
         fptr->writeconv_initialized = 1;
 
-        rb_econv_opts(Qnil, &fptr->writeconv_pre_opts);
-
+        /* ECONV_INVALID_XXX and ECONV_UNDEF_XXX should be set both.
+         * But ECONV_CRLF_NEWLINE_ENCODER should be set only for the first. */
+        fptr->writeconv_pre_opts = fptr->encs.opts;
         ecopts = fptr->encs.opts;
 
 #ifdef TEXTMODE_NEWLINE_ENCODER
-        if (NEED_NEWLINE_ENCODER(fptr))
-            ecopts.flags |= TEXTMODE_NEWLINE_ENCODER;
-
         if (!fptr->encs.enc) {
+            if (NEED_NEWLINE_ENCODER(fptr))
+                ecopts.flags |= TEXTMODE_NEWLINE_ENCODER;
             fptr->writeconv = rb_econv_open("", "", &ecopts);
             if (!fptr->writeconv)
                 rb_exc_raise(rb_econv_open_exc("", "", &ecopts));
             fptr->writeconv_stateless = Qnil;
             return;
         }
+
+        if (NEED_NEWLINE_ENCODER(fptr))
+            fptr->writeconv_pre_opts.flags |= TEXTMODE_NEWLINE_ENCODER;
 #endif
 
         enc = fptr->encs.enc2 ? fptr->encs.enc2 : fptr->encs.enc;
@@ -726,10 +729,6 @@
             denc = NULL;
             fptr->writeconv_stateless = Qnil;
             fptr->writeconv = NULL;
-#ifdef TEXTMODE_NEWLINE_ENCODER
-            if (NEED_NEWLINE_ENCODER(fptr))
-                fptr->writeconv_pre_opts.flags |= TEXTMODE_NEWLINE_ENCODER;
-#endif
         }
     }
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]