浏览代码

build: fixes for Visual Studio 2015

This patch contains minor fixes to build on Windows Visual Studio 2015
without any warnings.

Signed-off-by: Keith Holman <keith.holman@windriver.com>
Keith Holman 7 年之前
父节点
当前提交
1cba5c2043
共有 1 个文件被更改,包括 11 次插入9 次删除
  1. 11 9
      src/civetweb.c

+ 11 - 9
src/civetweb.c

@@ -391,12 +391,6 @@ _civet_safe_clock_gettime(int clk_id, struct timespec *t)
 #define MG_BUF_LEN (1024 * 8)
 #endif
 
-/* Maximum queue length for pending connections. This value is passed as
- * parameter to the "listen" socket call. */
-#if !defined(SOMAXCONN)
-#define SOMAXCONN (100) /* in pending connections (count) */
-#endif
-
 /* Size of the accepted socket queue (in case the old queue implementation
  * is used). */
 #if !defined(MGSQLEN)
@@ -808,6 +802,12 @@ typedef int SOCKET;
 #endif /* defined(_WIN32) && !defined(__SYMBIAN32__) -                         \
           WINDOWS / UNIX include block */
 
+/* Maximum queue length for pending connections. This value is passed as
+ * parameter to the "listen" socket call. */
+#if !defined(SOMAXCONN)
+/* This symbol may be defined in winsock2.h so this must after that include */
+#define SOMAXCONN (100) /* in pending connections (count) */
+#endif
 
 /* In case our C library is missing "timegm", provide an implementation */
 #if defined(NEED_TIMEGM)
@@ -5535,7 +5535,7 @@ kill(pid_t pid, int sig_num)
 #endif
 
 
-pid_t
+static pid_t
 waitpid(pid_t pid, int *status, int flags)
 {
 	DWORD timeout = INFINITE;
@@ -8831,7 +8831,9 @@ connect_socket(struct mg_context *ctx /* may be NULL */,
 	if (conn_ret != 0) {
 		DWORD err = WSAGetLastError(); /* could return WSAEWOULDBLOCK */
 		conn_ret = (int)err;
-#define EINPROGRESS (WSAEWOULDBLOCK) /* Winsock equivalent */
+#if !defined(EINPROGRESS)
+#	define EINPROGRESS (WSAEWOULDBLOCK) /* Winsock equivalent */
+#endif /* if !defined(EINPROGRESS) */
 	}
 #endif
 
@@ -10823,7 +10825,7 @@ abort_process(void *data)
 		kill(pid, SIGABRT);
 
 		/* Wait until process is terminated (don't leave zombies) */
-		while (waitpid(pid, &status, 0) != -1) /* nop */
+		while (waitpid(pid, &status, 0) != (pid_t)-1) /* nop */
 			;
 	} else {
 		DEBUG_TRACE("CGI timer: Child process %p already stopped in time\n",