Browse Source

Fix system specific pre-processor defines

bel 9 years ago
parent
commit
61b9afa121
2 changed files with 17 additions and 8 deletions
  1. 6 3
      src/civetweb.c
  2. 11 5
      src/main.c

+ 6 - 3
src/civetweb.c

@@ -194,7 +194,8 @@ int clock_gettime(int clk_id, struct timespec *t)
 mg_static_assert(MAX_WORKER_THREADS >= 1,
 mg_static_assert(MAX_WORKER_THREADS >= 1,
                  "worker threads must be a positive number");
                  "worker threads must be a positive number");
 
 
-#if defined(_WIN32) && !defined(__SYMBIAN32__) /* Windows specific */
+#if defined(_WIN32) &&                                                         \
+    !defined(__SYMBIAN32__) /* WINDOWS / UNIX include block */
 #include <windows.h>
 #include <windows.h>
 #include <winsock2.h> /* DTL add for SO_EXCLUSIVE */
 #include <winsock2.h> /* DTL add for SO_EXCLUSIVE */
 #include <ws2tcpip.h>
 #include <ws2tcpip.h>
@@ -370,7 +371,8 @@ struct pollfd {
 #pragma comment(lib, "Ws2_32.lib")
 #pragma comment(lib, "Ws2_32.lib")
 #endif
 #endif
 
 
-#else /* UNIX  specific */
+#else /* defined(_WIN32) && !defined(__SYMBIAN32__) - WINDOWS / UNIX include   \
+         block */
 #include <sys/wait.h>
 #include <sys/wait.h>
 #include <sys/socket.h>
 #include <sys/socket.h>
 #include <sys/poll.h>
 #include <sys/poll.h>
@@ -438,7 +440,8 @@ typedef int SOCKET;
 #define socklen_t int
 #define socklen_t int
 #endif /* hpux */
 #endif /* hpux */
 
 
-#endif /* End of Windows and UNIX specific includes */
+#endif /* defined(_WIN32) && !defined(__SYMBIAN32__) - WINDOWS / UNIX include  \
+          block */
 
 
 /* va_copy should always be a macro, C99 and C++11 - DTL */
 /* va_copy should always be a macro, C99 and C++11 - DTL */
 #ifndef va_copy
 #ifndef va_copy

+ 11 - 5
src/main.c

@@ -44,7 +44,6 @@
 #endif
 #endif
 
 
 #include <sys/stat.h>
 #include <sys/stat.h>
-#include <sys/utsname.h>
 #include <stdio.h>
 #include <stdio.h>
 #include <stdint.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <stdlib.h>
@@ -59,7 +58,8 @@
 
 
 #include "civetweb.h"
 #include "civetweb.h"
 
 
-#ifdef _WIN32
+#if defined(_WIN32) &&                                                         \
+    !defined(__SYMBIAN32__) /* WINDOWS / UNIX include block */
 #ifndef _WIN32_WINNT
 #ifndef _WIN32_WINNT
 #define _WIN32_WINNT 0x0501 /* for tdm-gcc so we can use getconsolewindow */
 #define _WIN32_WINNT 0x0501 /* for tdm-gcc so we can use getconsolewindow */
 #endif
 #endif
@@ -94,13 +94,19 @@ static int guard = 0; /* test if any dialog is already open */
 #define sleep(x) (Sleep((x)*1000))
 #define sleep(x) (Sleep((x)*1000))
 #define WINCDECL __cdecl
 #define WINCDECL __cdecl
 #define abs_path(rel, abs, abs_size) (_fullpath((abs), (rel), (abs_size)))
 #define abs_path(rel, abs, abs_size) (_fullpath((abs), (rel), (abs_size)))
-#else
+
+#else /* defined(_WIN32) && !defined(__SYMBIAN32__) - WINDOWS / UNIX include   \
+         block */
+
+#include <sys/utsname.h>
 #include <sys/wait.h>
 #include <sys/wait.h>
 #include <unistd.h>
 #include <unistd.h>
 #define DIRSEP '/'
 #define DIRSEP '/'
 #define WINCDECL
 #define WINCDECL
 #define abs_path(rel, abs, abs_size) (realpath((rel), (abs)))
 #define abs_path(rel, abs, abs_size) (realpath((rel), (abs)))
-#endif /* _WIN32 */
+
+#endif /* defined(_WIN32) && !defined(__SYMBIAN32__) - WINDOWS / UNIX include  \
+          block */
 
 
 #define MAX_OPTIONS (50)
 #define MAX_OPTIONS (50)
 #define MAX_CONF_FILE_LINE_SIZE (8 * 1024)
 #define MAX_CONF_FILE_LINE_SIZE (8 * 1024)
@@ -757,7 +763,7 @@ static void start_civetweb(int argc, char *argv[])
 #endif
 #endif
 #else
 #else
 		struct utsname name;
 		struct utsname name;
-                memset(&name, 0, sizeof(name));
+		memset(&name, 0, sizeof(name));
 		uname(&name);
 		uname(&name);
 		printf("\n%s\n", g_server_name);
 		printf("\n%s\n", g_server_name);
 		printf("%s - %s %s (%s) - %s\n",
 		printf("%s - %s %s (%s) - %s\n",