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

ruby-changes:29653

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

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

  New Revision: 41706

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

  Log:
    win32.c: UTF-8 spawn
    
    * win32/win32.c (w32_spawn): extract codepage aware code from
      rb_w32_spawn().
    * win32/win32.c (rb_w32_uspawn): add UTF-8 version function.

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

Index: include/ruby/win32.h
===================================================================
--- include/ruby/win32.h	(revision 41705)
+++ include/ruby/win32.h	(revision 41706)
@@ -316,6 +316,7 @@ 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_uspawn(int, const char *, const char*);
 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);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41705)
+++ ChangeLog	(revision 41706)
@@ -1,4 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Sun Jun 30 10:59:00 2013  Nobuyoshi Nakada  <nobu@r...>
+Sun Jun 30 10:59:04 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* win32/win32.c (w32_spawn): extract codepage aware code from
+	  rb_w32_spawn().
+
+	* win32/win32.c (rb_w32_uspawn): add UTF-8 version function.
 
 	* win32/win32.c (w32_aspawn_flags): extract codepage aware code from
 	  rb_w32_aspawn_flags().
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 41705)
+++ win32/win32.c	(revision 41706)
@@ -1180,7 +1180,7 @@ static char *wstr_to_mbstr(UINT, const W https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1180
 
 /* License: Artistic or GPL */
 rb_pid_t
-rb_w32_spawn(int mode, const char *cmd, const char *prog)
+w32_spawn(int mode, const char *cmd, const char *prog, UINT cp)
 {
     char fbuf[MAXPATHLEN];
     char *p = NULL;
@@ -1270,10 +1270,9 @@ rb_w32_spawn(int mode, const char *cmd, https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1270
 	}
     }
 
-    /* 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 && shell && !(wshell = acp_to_wstr(shell, NULL))) e = E2BIG;
+    if (!e && shell && !(wshell = mbstr_to_wstr(cp, shell, -1, NULL))) e = E2BIG;
     if (v2) ALLOCV_END(v2);
 
     if (!e) {
@@ -1285,6 +1284,21 @@ rb_w32_spawn(int mode, const char *cmd, https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1284
     return ret;
 }
 
+/* License: Ruby's */
+rb_pid_t
+rb_w32_spawn(int mode, const char *cmd, const char *prog)
+{
+    /* assume ACP */
+    return w32_spawn(mode, cmd, prog, filecp());
+}
+
+/* License: Ruby's */
+rb_pid_t
+rb_w32_uspawn(int mode, const char *cmd, const char *prog)
+{
+    return w32_spawn(mode, cmd, prog, CP_UTF8);
+}
+
 /* License: Artistic or GPL */
 rb_pid_t
 w32_aspawn_flags(int mode, const char *prog, char *const *argv, DWORD flags, UINT cp)

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

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