Author: cazfi
Date: Fri Jul 22 10:49:52 2016
New Revision: 33292

URL: http://svn.gna.org/viewcvs/freeciv?rev=33292&view=rev
Log:
Replaced all uses of WIN32_NATIVE with FREECIV_MSWINDOWS in utility/

See patch #7387

Modified:
    trunk/utility/netfile.c
    trunk/utility/netintf.c
    trunk/utility/shared.c
    trunk/utility/support.c

Modified: trunk/utility/netfile.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/netfile.c?rev=33292&r1=33291&r2=33292&view=diff
==============================================================================
--- trunk/utility/netfile.c     (original)
+++ trunk/utility/netfile.c     Fri Jul 22 10:49:52 2016
@@ -17,7 +17,7 @@
 
 #include <curl/curl.h>
 
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
 #include <windows.h>
 #endif
 

Modified: trunk/utility/netintf.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/netintf.c?rev=33292&r1=33291&r2=33292&view=diff
==============================================================================
--- trunk/utility/netintf.c     (original)
+++ trunk/utility/netintf.c     Fri Jul 22 10:49:52 2016
@@ -45,7 +45,7 @@
 #ifdef HAVE_SYS_SIGNAL_H
 #include <sys/signal.h>
 #endif
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
 #include <windows.h>   /* GetTempPath */
 #endif
 
@@ -295,7 +295,7 @@
 ***************************************************************************/
 int sockaddr_size(union fc_sockaddr *addr)
 {
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
   return sizeof(*addr);
 #else
 #ifdef FREECIV_IPV6_SUPPORT
@@ -312,7 +312,7 @@
 
     return 0;
   }
-#endif /* WIN32_NATIVE */
+#endif /* FREECIV_MSWINDOWS */
 }
 
 /***************************************************************************
@@ -499,7 +499,7 @@
     char tmp[4096];
     int n;
 
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
     /* tmpfile() in mingw attempts to make a temp file in the root directory
      * of the current drive, which we may not have write access to. */
     {
@@ -510,11 +510,11 @@
 
       fp = fc_fopen(filename, "w+b");
     }
-#else  /* WIN32_NATIVE */
+#else  /* FREECIV_MSWINDOWS */
 
     fp = tmpfile();
 
-#endif /* WIN32_NATIVE */
+#endif /* FREECIV_MSWINDOWS */
 
     if (fp == NULL) {
       return NULL;

Modified: trunk/utility/shared.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/shared.c?rev=33292&r1=33291&r2=33292&view=diff
==============================================================================
--- trunk/utility/shared.c      (original)
+++ trunk/utility/shared.c      Fri Jul 22 10:49:52 2016
@@ -41,14 +41,14 @@
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
 #include <windows.h>
 #include <lmcons.h>    /* UNLEN */
 #include <shlobj.h>
 #ifdef HAVE_DIRECT_H
 #include <direct.h>
 #endif /* HAVE_DIRECT_H */
-#endif /* WIN32_NATIVE */
+#endif /* FREECIV_MSWINDOWS */
 
 /* utility */
 #include "astring.h"
@@ -712,8 +712,8 @@
   }
 #endif /* HAVE_GETPWUID */
 
-#ifdef WIN32_NATIVE
-  /* On win32 the GetUserName function will give us the login name. */
+#ifdef FREECIV_MSWINDOWS
+  /* On windows the GetUserName function will give us the login name. */
   {
     char name[UNLEN + 1];
     DWORD length = sizeof(name);
@@ -726,7 +726,7 @@
       }
     }
   }
-#endif /* WIN32_NATIVE */
+#endif /* FREECIV_MSWINDOWS */
 
 #ifdef ALWAYS_ROOT
   fc_strlcpy(buf, "name", bufsz);
@@ -1040,12 +1040,12 @@
 ***************************************************************************/
 const char *fileinfoname(const struct strvec *dirs, const char *filename)
 {
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
   char fnbuf[strlen(filename) + 1];
   int i;
-#else  /* WIN32_NATIVE */
+#else  /* FREECIV_MSWINDOWS */
   const char *fnbuf = filename;
-#endif /* WIN32_NATIVE */
+#endif /* FREECIV_MSWINDOWS */
 
   if (NULL == dirs) {
     return NULL;
@@ -1232,7 +1232,7 @@
 #ifdef ENABLE_NLS
   langname = getenv("LANG");
 
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
   /* set LANG by hand if it is not set */
   if (!langname) {
     switch (PRIMARYLANGID(GetUserDefaultLangID())) {
@@ -1343,7 +1343,7 @@
       putenv(envstr);
     }
   }
-#endif /* WIN32_NATIVE */
+#endif /* FREECIV_MSWINDOWS */
 #endif /* ENABLE_NLS */
 
   return langname;
@@ -1418,9 +1418,9 @@
 
 #ifdef ENABLE_NLS
 
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
   setup_langname(); /* Makes sure LANG env variable has been set */
-#endif /* WIN32_NATIVE */
+#endif /* FREECIV_MSWINDOWS */
 
   (void) setlocale(LC_ALL, "");
   (void) bindtextdomain("freeciv-core", get_locale_dir());
@@ -1722,7 +1722,7 @@
       *dir = 0;
     }
 
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
 #ifdef HAVE__MKDIR
     /* Prefer _mkdir() in Windows even if mkdir() would seem to be available -
      * chances are that it's wrong kind of mkdir().
@@ -1737,9 +1737,9 @@
 #else  /* HAVE__MKDIR */
     mkdir(path, 0755);
 #endif /* HAVE__MKDIR */
-#else  /* WIN32_NATIVE */
+#else  /* FREECIV_MSWINDOWS */
     mkdir(path, 0755);
-#endif /* WIN32_NATIVE */
+#endif /* FREECIV_MSWINDOWS */
 
     if (dir) {
       *dir = DIR_SEPARATOR_CHAR;
@@ -1760,15 +1760,15 @@
     return FALSE;
   }
 
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
   if (strchr(filename, ':')) {
     return TRUE;
   }
-#else  /* WIN32_NATIVE */
+#else  /* FREECIV_MSWINDOWS */
   if (filename[0] == '/') {
     return TRUE;
   }
-#endif /* WIN32_NATIVE */
+#endif /* FREECIV_MSWINDOWS */
 
   return FALSE;
 }

Modified: trunk/utility/support.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/support.c?rev=33292&r1=33291&r2=33292&view=diff
==============================================================================
--- trunk/utility/support.c     (original)
+++ trunk/utility/support.c     Fri Jul 22 10:49:52 2016
@@ -79,10 +79,10 @@
 #ifdef FREECIV_HAVE_LIBZ
 #include <zlib.h>
 #endif
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
 #include <process.h>
 #include <windows.h>
-#endif
+#endif /* FREECIV_MSWINDOWS */
 #ifdef HAVE_STRINGS_H
 #  include <strings.h>
 #endif
@@ -424,16 +424,17 @@
 ****************************************************************/
 FILE *fc_fopen(const char *filename, const char *opentype)
 {
-#ifdef WIN32_NATIVE
-       FILE *result;
-       char *filename_in_local_encoding =
-            internal_to_local_string_malloc(filename);
-       result = fopen(filename_in_local_encoding, opentype);
-       free(filename_in_local_encoding);
-       return result;
-#else  /* WIN32_NATIVE */
-       return fopen(filename, opentype);
-#endif /* WIN32_NATIVE */
+#ifdef FREECIV_MSWINDOWS
+  FILE *result;
+  char *filename_in_local_encoding =
+    internal_to_local_string_malloc(filename);
+
+  result = fopen(filename_in_local_encoding, opentype);
+  free(filename_in_local_encoding);
+  return result;
+#else  /* FREECIV_MSWINDOWS */
+  return fopen(filename, opentype);
+#endif /* FREECIV_MSWINDOWS */
 }
 
 /*****************************************************************
@@ -443,16 +444,17 @@
 #ifdef FREECIV_HAVE_LIBZ
 gzFile fc_gzopen(const char *filename, const char *opentype)
 {
-#ifdef WIN32_NATIVE
-       gzFile result;
-       char *filename_in_local_encoding =
-            internal_to_local_string_malloc(filename);
-       result = gzopen(filename_in_local_encoding, opentype);
-       free(filename_in_local_encoding);
-       return result;
-#else  /* WIN32_NATIVE */
-       return gzopen(filename, opentype);
-#endif /* WIN32_NATIVE */
+#ifdef FREECIV_MSWINDOWS
+  gzFile result;
+  char *filename_in_local_encoding =
+    internal_to_local_string_malloc(filename);
+
+  result = gzopen(filename_in_local_encoding, opentype);
+  free(filename_in_local_encoding);
+  return result;
+#else  /* FREECIV_MSWINDOWS */
+  return gzopen(filename, opentype);
+#endif /* FREECIV_MSWINDOWS */
 }
 #endif /* FREECIV_HAVE_LIBZ */
 
@@ -462,16 +464,17 @@
 ******************************************************************/
 DIR *fc_opendir(const char *dir_to_open)
 {
-#ifdef WIN32_NATIVE
-       DIR *result;
-       char *dirname_in_local_encoding =
-            internal_to_local_string_malloc(dir_to_open);
-       result = opendir(dirname_in_local_encoding);
-       free(dirname_in_local_encoding);
-       return result;
-#else  /* WIN32_NATIVE */
-       return opendir(dir_to_open);
-#endif /* WIN32_NATIVE */
+#ifdef FREECIV_MSWINDOWS
+  DIR *result;
+  char *dirname_in_local_encoding =
+    internal_to_local_string_malloc(dir_to_open);
+
+  result = opendir(dirname_in_local_encoding);
+  free(dirname_in_local_encoding);
+  return result;
+#else  /* FREECIV_MSWINDOWS */
+  return opendir(dir_to_open);
+#endif /* FREECIV_MSWINDOWS */
 }
 
 /*****************************************************************
@@ -480,16 +483,17 @@
 *****************************************************************/
 int fc_remove(const char *filename)
 {
-#ifdef WIN32_NATIVE
-       int result;
-       char *filename_in_local_encoding =
-            internal_to_local_string_malloc(filename);
-       result = remove(filename_in_local_encoding);
-       free(filename_in_local_encoding);
-       return result;
-#else  /* WIN32_NATIVE */
-       return remove(filename);
-#endif /* WIN32_NATIVE */
+#ifdef FREECIV_MSWINDOWS
+  int result;
+  char *filename_in_local_encoding =
+    internal_to_local_string_malloc(filename);
+
+  result = remove(filename_in_local_encoding);
+  free(filename_in_local_encoding);
+  return result;
+#else  /* FREECIV_MSWINDOWS */
+  return remove(filename);
+#endif /* FREECIV_MSWINDOWS */
 }
 
 /*****************************************************************
@@ -498,16 +502,17 @@
 *****************************************************************/
 int fc_stat(const char *filename, struct stat *buf)
 {
-#ifdef WIN32_NATIVE
-       int result;
-       char *filename_in_local_encoding =
-            internal_to_local_string_malloc(filename);
-       result = stat(filename_in_local_encoding, buf);
-       free(filename_in_local_encoding);
-       return result;
-#else  /* WIN32_NATIVE */
-       return stat(filename, buf);
-#endif /* WIN32_NATIVE */
+#ifdef FREECIV_MSWINDOWS
+  int result;
+  char *filename_in_local_encoding =
+    internal_to_local_string_malloc(filename);
+
+  result = stat(filename_in_local_encoding, buf);
+  free(filename_in_local_encoding);
+  return result;
+#else  /* FREECIV_MSWINDOWS */
+  return stat(filename, buf);
+#endif /* FREECIV_MSWINDOWS */
 }
 
 /***************************************************************
@@ -515,11 +520,11 @@
 ***************************************************************/
 fc_errno fc_get_errno(void)
 {
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
   return GetLastError();
-#else
+#else  /* FREECIV_MSWINDOWS */
   return errno;
-#endif
+#endif /* FREECIV_MSWINDOWS */
 }
 
 /***************************************************************
@@ -532,7 +537,7 @@
 ***************************************************************/
 const char *fc_strerror(fc_errno err)
 {
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
   static char buf[256];
 
   if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | 
FORMAT_MESSAGE_IGNORE_INSERTS,
@@ -541,7 +546,7 @@
                _("error %ld (failed FormatMessage)"), err);
   }
   return buf;
-#else  /* WIN32_NATIVE */
+#else  /* FREECIV_MSWINDOWS */
 #ifdef HAVE_STRERROR
   static char buf[256];
 
@@ -554,9 +559,8 @@
              _("error %d (compiled without strerror)"), err);
   return buf;
 #endif /* HAVE_STRERROR */
-#endif /* WIN32_NATIVE */
-}
-
+#endif /* FREECIV_MSWINDOWS */
+}
 
 /***************************************************************
   Suspend execution for the specified number of microseconds.
@@ -571,21 +575,25 @@
 #else  /* HAVE_SNOOZE */
 #ifdef GENERATING_MAC
   EventRecord the_event;       /* dummy - always be a null event */
+
   usec /= 16666;               /* microseconds to 1/60th seconds */
-  if (usec < 1) usec = 1;
-  /* suposed to give other application processor time for the mac */
+  if (usec < 1) {
+    usec = 1;
+  }
+  /* supposed to give other application processor time for the mac */
   WaitNextEvent(0, &the_event, usec, 0L);
 #else  /* GENERATING_MAC */
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
   Sleep(usec / 1000);
-#else  /* WIN32_NATIVE */
+#else  /* FREECIV_MSWINDOWS */
   struct timeval tv;
-  tv.tv_sec=0;
-  tv.tv_usec=usec;
+
+  tv.tv_sec = 0;
+  tv.tv_usec = usec;
   /* FIXME: an interrupt can cause an EINTR return here.  In that case we
    * need to have another select call. */
   fc_select(0, NULL, NULL, NULL, &tv);
-#endif /* WIN32_NATIVE */
+#endif /* FREECIV_MSWINDOWS */
 #endif /* GENERATING_MAC */
 #endif /* HAVE_SNOOZE */
 #endif /* HAVE_USLEEP */
@@ -938,7 +946,7 @@
 
 /**********************************************************************/
 
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
 static HANDLE console_thread = INVALID_HANDLE_VALUE;
 
 static DWORD WINAPI thread_proc(LPVOID arg)
@@ -953,14 +961,14 @@
 
   return 0;
 }
-#endif /* WIN32_NATIVE */
+#endif /* FREECIV_MSWINDOWS */
 
 /**********************************************************************
   Initialize console I/O in case FREECIV_SOCKET_ZERO_NOT_STDIN.
 ***********************************************************************/
 void fc_init_console(void)
 {
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
   DWORD threadid;
 
   if (console_thread != INVALID_HANDLE_VALUE) {
@@ -969,7 +977,7 @@
 
   console_buf[0] = '\0';
   console_thread = (HANDLE) CreateThread(NULL, 0, thread_proc, NULL, 0, 
&threadid);
-#else  /* WIN32_NATIVE */
+#else  /* FREECIV_MSWINDOWS */
   static bool initialized = FALSE;
 
   if (!initialized) {
@@ -978,7 +986,7 @@
     fc_nonblock(fileno(stdin));
 #endif
   }
-#endif /* WIN32_NATIVE */
+#endif /* FREECIV_MSWINDOWS */
 }
 
 /**********************************************************************
@@ -990,7 +998,7 @@
 ***********************************************************************/
 char *fc_read_console(void)
 {
-#ifdef WIN32_NATIVE
+#ifdef FREECIV_MSWINDOWS
   if (WaitForSingleObject(console_thread, 0) == WAIT_OBJECT_0) {
     CloseHandle(console_thread);
     console_thread = INVALID_HANDLE_VALUE;
@@ -999,7 +1007,7 @@
   }
 
   return NULL;
-#else  /* WIN32_NATIVE */
+#else  /* FREECIV_MSWINDOWS */
   if (!feof(stdin)) {    /* input from server operator */
     static char *bufptr = console_buf;
 
@@ -1021,7 +1029,7 @@
   }
 
   return NULL;
-#endif /* WIN32_NATIVE */
+#endif /* FREECIV_MSWINDOWS */
 }
 
 #endif /* FREECIV_SOCKET_ZERO_NOT_STDIN */


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to