[tor-commits] [tor/master] Remove code for Windows CE support

nickm at torproject.org nickm at torproject.org
Fri Jun 20 13:52:05 UTC 2014


commit 5b4ee475aa00bb30675e819a0096209e5e427668
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Jun 20 09:49:36 2014 -0400

    Remove code for Windows CE support
    
    As far as I know, nobody has used this in ages.  It would be a
    pretty big surprise if it had worked.
    
    Closes ticket 11446.
---
 changes/no-wince       |    4 ++++
 src/common/compat.c    |    9 ---------
 src/common/compat.h    |   15 ---------------
 src/common/tortls.c    |    4 ----
 src/common/util.c      |    2 +-
 src/or/main.c          |   50 ------------------------------------------------
 src/or/ntmain.h        |    2 --
 src/test/test_config.c |   10 +++++-----
 src/win32/orconfig.h   |    9 +--------
 9 files changed, 11 insertions(+), 94 deletions(-)

diff --git a/changes/no-wince b/changes/no-wince
new file mode 100644
index 0000000..833bf46
--- /dev/null
+++ b/changes/no-wince
@@ -0,0 +1,4 @@
+  o Removed platform support:
+    - We no longer include special code to build on Windows CE; as far
+      as we know, nobody has used Tor on Windows CE in a very long
+      time. Closes ticket 11446.
diff --git a/src/common/compat.c b/src/common/compat.c
index e25ecc4..6fb9c21 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -2485,14 +2485,12 @@ get_uname(void)
                          "Unrecognized version of Windows [major=%d,minor=%d]",
                          (int)info.dwMajorVersion,(int)info.dwMinorVersion);
         }
-#if !defined (WINCE)
 #ifdef VER_NT_SERVER
       if (info.wProductType == VER_NT_SERVER ||
           info.wProductType == VER_NT_DOMAIN_CONTROLLER) {
         strlcat(uname_result, " [server]", sizeof(uname_result));
       }
 #endif
-#endif
 #else
         strlcpy(uname_result, "Unknown platform", sizeof(uname_result));
 #endif
@@ -2697,15 +2695,8 @@ tor_gettimeofday(struct timeval *timeval)
     uint64_t ft_64;
     FILETIME ft_ft;
   } ft;
-#if defined (WINCE)
-  /* wince do not have GetSystemTimeAsFileTime */
-  SYSTEMTIME stime;
-  GetSystemTime(&stime);
-  SystemTimeToFileTime(&stime,&ft.ft_ft);
-#else
   /* number of 100-nsec units since Jan 1, 1601 */
   GetSystemTimeAsFileTime(&ft.ft_ft);
-#endif
   if (ft.ft_64 < EPOCH_BIAS) {
     log_err(LD_GENERAL,"System time is before 1970; failing.");
     exit(1);
diff --git a/src/common/compat.h b/src/common/compat.h
index ec7d241..635e427 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -56,21 +56,6 @@
 #include <stdio.h>
 #include <errno.h>
 
-#if defined (WINCE)
-#include <fcntl.h>
-#include <io.h>
-#include <math.h>
-#include <projects.h>
-/* this is not exported as W .... */
-#define SHGetPathFromIDListW SHGetPathFromIDList
-/* wcecompat has vasprintf */
-#define HAVE_VASPRINTF
-/* no service here */
-#ifdef NT_SERVICE
-#undef NT_SERVICE
-#endif
-#endif // WINCE
-
 #ifndef NULL_REP_IS_ZERO_BYTES
 #error "It seems your platform does not represent NULL as zero. We can't cope."
 #endif
diff --git a/src/common/tortls.c b/src/common/tortls.c
index ea0f21c..e06a2ae 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -16,10 +16,6 @@
 
 #include "orconfig.h"
 
-#if defined (WINCE)
-#include <WinSock2.h>
-#endif
-
 #include <assert.h>
 #ifdef _WIN32 /*wrkard for dtls1.h >= 0.9.8m of "#include <winsock.h>"*/
  #ifndef _WIN32_WINNT
diff --git a/src/common/util.c b/src/common/util.c
index 2d7893b..8589344 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1893,7 +1893,7 @@ check_private_dir(const char *dirname, cpd_check_t check,
     }
     if (check & CPD_CREATE) {
       log_info(LD_GENERAL, "Creating directory %s", dirname);
-#if defined (_WIN32) && !defined (WINCE)
+#if defined (_WIN32)
       r = mkdir(dirname);
 #else
       r = mkdir(dirname, 0700);
diff --git a/src/or/main.c b/src/or/main.c
index 1c49ba1..8ba4fef 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2706,31 +2706,6 @@ do_dump_config(void)
   return 0;
 }
 
-#if defined (WINCE)
-int
-find_flashcard_path(PWCHAR path, size_t size)
-{
-  WIN32_FIND_DATA d = {0};
-  HANDLE h = NULL;
-
-  if (!path)
-    return -1;
-
-  h = FindFirstFlashCard(&d);
-  if (h == INVALID_HANDLE_VALUE)
-    return -1;
-
-  if (wcslen(d.cFileName) == 0) {
-    FindClose(h);
-    return -1;
-  }
-
-  wcsncpy(path,d.cFileName,size);
-  FindClose(h);
-  return 0;
-}
-#endif
-
 static void
 init_addrinfo(void)
 {
@@ -2959,31 +2934,6 @@ int
 tor_main(int argc, char *argv[])
 {
   int result = 0;
-#if defined (WINCE)
-  WCHAR path [MAX_PATH] = {0};
-  WCHAR fullpath [MAX_PATH] = {0};
-  PWCHAR p = NULL;
-  FILE* redir = NULL;
-  FILE* redirdbg = NULL;
-
-  // this is to facilitate debugging by opening
-  // a file on a folder shared by the wm emulator.
-  // if no flashcard (real or emulated) is present,
-  // log files will be written in the root folder
-  if (find_flashcard_path(path,MAX_PATH) == -1) {
-    redir = _wfreopen( L"\\stdout.log", L"w", stdout );
-    redirdbg = _wfreopen( L"\\stderr.log", L"w", stderr );
-  } else {
-    swprintf(fullpath,L"\\%s\\tor",path);
-    CreateDirectory(fullpath,NULL);
-
-    swprintf(fullpath,L"\\%s\\tor\\stdout.log",path);
-    redir = _wfreopen( fullpath, L"w", stdout );
-
-    swprintf(fullpath,L"\\%s\\tor\\stderr.log",path);
-    redirdbg = _wfreopen( fullpath, L"w", stderr );
-  }
-#endif
 
 #ifdef _WIN32
   /* Call SetProcessDEPPolicy to permanently enable DEP.
diff --git a/src/or/ntmain.h b/src/or/ntmain.h
index d302793..d09a413 100644
--- a/src/or/ntmain.h
+++ b/src/or/ntmain.h
@@ -13,10 +13,8 @@
 #define TOR_NTMAIN_H
 
 #ifdef _WIN32
-#if !defined (WINCE)
 #define NT_SERVICE
 #endif
-#endif
 
 #ifdef NT_SERVICE
 int nt_service_parse_options(int argc, char **argv, int *should_exit);
diff --git a/src/test/test_config.c b/src/test/test_config.c
index 94ac4dc..b35984f 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -184,7 +184,7 @@ is_private_dir(const char* path)
   if (r) {
     return 0;
   }
-#if !defined (_WIN32) || defined (WINCE)
+#if !defined (_WIN32)
   if ((st.st_mode & (S_IFDIR | 0777)) != (S_IFDIR | 0700)) {
     return 0;
   }
@@ -201,7 +201,7 @@ test_config_check_or_create_data_subdir(void *arg)
   char *subpath;
   struct stat st;
   int r;
-#if !defined (_WIN32) || defined (WINCE)
+#if !defined (_WIN32)
   unsigned group_permission;
 #endif
   (void)arg;
@@ -210,7 +210,7 @@ test_config_check_or_create_data_subdir(void *arg)
   datadir = options->DataDirectory = tor_strdup(get_fname("datadir-0"));
   subpath = get_datadir_fname(subdir);
 
-#if defined (_WIN32) && !defined (WINCE)
+#if defined (_WIN32)
   tt_int_op(mkdir(options->DataDirectory), ==, 0);
 #else
   tt_int_op(mkdir(options->DataDirectory, 0700), ==, 0);
@@ -233,7 +233,7 @@ test_config_check_or_create_data_subdir(void *arg)
     tt_abort_perror("stat");
   }
 
-#if !defined (_WIN32) || defined (WINCE)
+#if !defined (_WIN32)
   group_permission = st.st_mode | 0070;
   r = chmod(subpath, group_permission);
 
@@ -284,7 +284,7 @@ test_config_write_to_data_subdir(void *arg)
   datadir = options->DataDirectory = tor_strdup(get_fname("datadir-1"));
   filepath = get_datadir_fname2(subdir, fname);
 
-#if defined (_WIN32) && !defined (WINCE)
+#if defined (_WIN32)
   tt_int_op(mkdir(options->DataDirectory), ==, 0);
 #else
   tt_int_op(mkdir(options->DataDirectory, 0700), ==, 0);
diff --git a/src/win32/orconfig.h b/src/win32/orconfig.h
index 2f1a53c..d12d667 100644
--- a/src/win32/orconfig.h
+++ b/src/win32/orconfig.h
@@ -86,18 +86,11 @@
 #define HAVE_STRING_H
 
 /* Define to 1 if you have the `strlcat' function. */
-#if defined (WINCE)
-#define HAVE_STRLCAT
-#else
 #undef HAVE_STRLCAT
-#endif
 
 /* Define to 1 if you have the `strlcpy' function. */
-#if defined (WINCE)
-#define HAVE_STRLCPY
-#else
 #undef HAVE_STRLCPY
-#endif
+
 /* Define to 1 if you have the `strptime' function. */
 #undef HAVE_STRPTIME
 



More information about the tor-commits mailing list