[tor-commits] [tor/master] Fix mingw build with -DUNICODE -D_UNICODE

nickm at torproject.org nickm at torproject.org
Mon Jun 11 14:19:34 UTC 2012


commit bf9252587b4d7d970f02631b308451fb05ec5560
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Jun 7 11:59:32 2012 -0400

    Fix mingw build with -DUNICODE -D_UNICODE
    
    This is a very blunt fix, and mostly just turns some func() calls
    into FuncA() to make things build again.  Fixes bug 6097.
---
 changes/fix_unicode  |    3 +++
 src/common/util.c    |    4 ++--
 src/test/test.c      |    2 +-
 src/test/test_util.c |    6 +++++-
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/changes/fix_unicode b/changes/fix_unicode
new file mode 100644
index 0000000..b97c393
--- /dev/null
+++ b/changes/fix_unicode
@@ -0,0 +1,3 @@
+  o Minor bugfixes:
+    - Make Tor build correctly again with -DUNICODE -D_UNICODE defined.
+      Bugfix on 0.2.2.16-alpha; fixes bug 6097.
diff --git a/src/common/util.c b/src/common/util.c
index dc8f8b7..28ecff3 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -3381,7 +3381,7 @@ tor_spawn_background(const char *const filename, const char **argv,
   process_handle_t *process_handle;
   int status;
 
-  STARTUPINFO siStartInfo;
+  STARTUPINFOA siStartInfo;
   BOOL retval = FALSE;
 
   SECURITY_ATTRIBUTES saAttr;
@@ -3442,7 +3442,7 @@ tor_spawn_background(const char *const filename, const char **argv,
 
   /* Create the child process */
 
-  retval = CreateProcess(filename,      // module name
+  retval = CreateProcessA(filename,      // module name
                  joined_argv,   // command line
   /* TODO: should we set explicit security attributes? (#2046, comment 5) */
                  NULL,          // process security attributes
diff --git a/src/test/test.c b/src/test/test.c
index 4f19f36..89b4ced 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -91,7 +91,7 @@ setup_directory(void)
     char buf[MAX_PATH];
     const char *tmp = buf;
     /* If this fails, we're probably screwed anyway */
-    if (!GetTempPath(sizeof(buf),buf))
+    if (!GetTempPathA(sizeof(buf),buf))
       tmp = "c:\\windows\\temp";
     tor_snprintf(temp_dir, sizeof(temp_dir),
                  "%s\\tor_test_%d", tmp, (int)getpid());
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 4b628ea..7484b9e 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -14,6 +14,10 @@
 #include "mempool.h"
 #include "memarea.h"
 
+#ifdef _WIN32
+#include <tchar.h>
+#endif
+
 static void
 test_util_time(void)
 {
@@ -2113,7 +2117,7 @@ test_util_parent_dir(void *ptr)
 static void
 test_util_load_win_lib(void *ptr)
 {
-  HANDLE h = load_windows_system_library("advapi32.dll");
+  HANDLE h = load_windows_system_library(_T("advapi32.dll"));
   (void) ptr;
 
   tt_assert(h);





More information about the tor-commits mailing list