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

ruby-changes:29654

From: nobu <ko1@a...>
Date: Sun, 30 Jun 2013 10:59:26 +0900 (JST)
Subject: [ruby-changes:29654] nobu:r41705 (trunk): win32.c: UTF-8 aspawn

nobu	2013-06-30 10:59:03 +0900 (Sun, 30 Jun 2013)

  New Revision: 41705

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

  Log:
    win32.c: UTF-8 aspawn
    
    * win32/win32.c (w32_aspawn_flags): extract codepage aware code from
      rb_w32_aspawn_flags().
    * win32/win32.c (rb_w32_uaspawn_flags, rb_w32_uaspawn_flags): add
      UTF-8 version functions.

  Modified files:
    trunk/ChangeLog
    trunk/include/ruby/win32.h
    trunk/win32/win32.c

Index: include/ruby/win32.h
===================================================================
--- include/ruby/win32.h	(revision 41704)
+++ include/ruby/win32.h	(revision 41705)
@@ -316,6 +316,8 @@ extern rb_pid_t waitpid (rb_pid_t, int * https://github.com/ruby/ruby/blob/trunk/include/ruby/win32.h#L316
 extern rb_pid_t rb_w32_spawn(int, const char *, const char*);
 extern rb_pid_t rb_w32_aspawn(int, const char *, char *const *);
 extern rb_pid_t rb_w32_aspawn_flags(int, const char *, char *const *, DWORD);
+extern rb_pid_t rb_w32_uaspawn(int, const char *, char *const *);
+extern rb_pid_t rb_w32_uaspawn_flags(int, const char *, char *const *, DWORD);
 extern int kill(int, int);
 extern int fcntl(int, int, ...);
 extern rb_pid_t rb_w32_getpid(void);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41704)
+++ ChangeLog	(revision 41705)
@@ -1,4 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Sun Jun 30 10:58:57 2013  Nobuyoshi Nakada  <nobu@r...>
+Sun Jun 30 10:59:00 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* win32/win32.c (w32_aspawn_flags): extract codepage aware code from
+	  rb_w32_aspawn_flags().
+
+	* win32/win32.c (rb_w32_uaspawn_flags, rb_w32_uaspawn_flags): add
+	  UTF-8 version functions.
 
 	* win32/win32.c (w32_getenv): extract codepage aware code from
 	  rb_w32_ugetenv() and rb_w32_getenv().
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 41704)
+++ win32/win32.c	(revision 41705)
@@ -1287,7 +1287,7 @@ rb_w32_spawn(int mode, const char *cmd, https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1287
 
 /* License: Artistic or GPL */
 rb_pid_t
-rb_w32_aspawn_flags(int mode, const char *prog, char *const *argv, DWORD flags)
+w32_aspawn_flags(int mode, const char *prog, char *const *argv, DWORD flags, UINT cp)
 {
     int c_switch = 0;
     size_t len;
@@ -1342,10 +1342,9 @@ rb_w32_aspawn_flags(int mode, const char https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1342
 	join_argv(cmd, argv, FALSE);
     }
 
-    /* assume ACP */
-    if (!e && cmd && !(wcmd = acp_to_wstr(cmd, NULL))) e = E2BIG;
+    if (!e && cmd && !(wcmd = mbstr_to_wstr(cp, cmd, -1, NULL))) e = E2BIG;
     if (v) ALLOCV_END(v);
-    if (!e && prog && !(wprog = acp_to_wstr(prog, NULL))) e = E2BIG;
+    if (!e && prog && !(wprog = mbstr_to_wstr(cp, prog, -1, NULL))) e = E2BIG;
 
     if (!e) {
 	ret = child_result(CreateChild(wcmd, wprog, NULL, NULL, NULL, NULL, flags), mode);
@@ -1356,12 +1355,35 @@ rb_w32_aspawn_flags(int mode, const char https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1355
     return ret;
 }
 
+/* License: Ruby's */
+rb_pid_t
+rb_w32_aspawn_flags(int mode, const char *prog, char *const *argv, DWORD flags)
+{
+    /* assume ACP */
+    return w32_aspawn_flags(mode, prog, argv, flags, filecp());
+}
+
+/* License: Ruby's */
+rb_pid_t
+rb_w32_uaspawn_flags(int mode, const char *prog, char *const *argv, DWORD flags)
+{
+    return w32_aspawn_flags(mode, prog, argv, flags, CP_UTF8);
+}
+
+/* License: Ruby's */
 rb_pid_t
 rb_w32_aspawn(int mode, const char *prog, char *const *argv)
 {
     return rb_w32_aspawn_flags(mode, prog, argv, 0);
 }
 
+/* License: Ruby's */
+rb_pid_t
+rb_w32_uaspawn(int mode, const char *prog, char *const *argv)
+{
+    return rb_w32_uaspawn_flags(mode, prog, argv, 0);
+}
+
 /* License: Artistic or GPL */
 typedef struct _NtCmdLineElement {
     struct _NtCmdLineElement *next;

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

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