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

ruby-changes:42668

From: nobu <ko1@a...>
Date: Sun, 24 Apr 2016 10:59:44 +0900 (JST)
Subject: [ruby-changes:42668] nobu:r54742 (trunk): Fix compile error other than gcc

nobu	2016-04-24 11:56:20 +0900 (Sun, 24 Apr 2016)

  New Revision: 54742

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54742

  Log:
    Fix compile error other than gcc

  Modified files:
    trunk/ruby.c
Index: ruby.c
===================================================================
--- ruby.c	(revision 54741)
+++ ruby.c	(revision 54742)
@@ -1413,7 +1413,10 @@ process_options(int argc, char **argv, s https://github.com/ruby/ruby/blob/trunk/ruby.c#L1413
     NODE *tree = 0;
     VALUE parser;
     const rb_iseq_t *iseq;
-    rb_encoding *enc, *lenc;
+    rb_encoding *enc, *lenc, *ienc = 0;
+#if UTF8_PATH
+    rb_encoding *uenc;
+#endif
     const char *s;
     char fbuf[MAXPATHLEN];
     int i = (int)proc_options(argc, argv, opt, 0);
@@ -1525,6 +1528,7 @@ process_options(int argc, char **argv, s https://github.com/ruby/ruby/blob/trunk/ruby.c#L1528
 	enc = rb_enc_from_index(opt->intern.enc.index);
 	rb_enc_set_default_internal(rb_enc_from_encoding(enc));
 	opt->intern.enc.index = -1;
+	ienc = enc;
     }
     rb_enc_associate(opt->script_name, lenc);
     rb_obj_freeze(opt->script_name);
@@ -1559,7 +1563,8 @@ process_options(int argc, char **argv, s https://github.com/ruby/ruby/blob/trunk/ruby.c#L1563
 #undef SET_COMPILE_OPTION
     }
 #if UTF8_PATH
-    opt->script_name = str_conv_enc(opt->script_name, rb_utf8_encoding(), lenc);
+    uenc = rb_utf8_encoding();
+    opt->script_name = str_conv_enc(opt->script_name, uenc, lenc);
     opt->script = RSTRING_PTR(opt->script_name);
 #endif
     ruby_set_argv(argc, argv);
@@ -1577,8 +1582,13 @@ process_options(int argc, char **argv, s https://github.com/ruby/ruby/blob/trunk/ruby.c#L1582
 	    eenc = rb_enc_from_index(opt->src.enc.index);
 	}
 	else {
-	    eenc = lenc;
+	    eenc = ienc ? ienc : lenc;
 	}
+#if UTF8_PATH
+	if (eenc != uenc)
+	    opt->e_script = str_conv_enc(opt->e_script, uenc, eenc);
+	else
+#endif
 	rb_enc_associate(opt->e_script, eenc);
 	if (!(opt->dump & ~DUMP_BIT(version_v))) {
 	    ruby_set_script_name(opt->script_name);

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

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