Pārlūkot izejas kodu

Include winsock2.h before windows.h

Tatsuhiro Tsujikawa 12 gadi atpakaļ
vecāks
revīzija
ce9eec5cb2
3 mainītis faili ar 13 papildinājumiem un 25 dzēšanām
  1. 1 13
      src/Platform.cc
  2. 0 10
      src/a2netcompat.h
  3. 12 2
      src/common.h

+ 1 - 13
src/Platform.cc

@@ -41,19 +41,6 @@
 
 #include <iostream>
 
-#ifdef HAVE_WINSOCK2_H
-
-#ifndef _WIN32_WINNT
-# define _WIN32_WINNT 0x501u
-#endif // _WIN32_WINNT
-#include <winsock2.h>
-#undef ERROR
-#ifdef HAVE_WS2TCPIP_H
-# include <ws2tcpip.h>
-#endif // HAVE_WS2TCPIP_H
-
-#endif // HAVE_WINSOCK2_H
-
 #ifdef HAVE_OPENSSL
 # include <openssl/err.h>
 # include <openssl/ssl.h>
@@ -69,6 +56,7 @@
 # include <ares.h>
 #endif // ENABLE_ASYNC_DNS
 
+#include "a2netcompat.h"
 #include "DlAbortEx.h"
 #include "message.h"
 #include "fmt.h"

+ 0 - 10
src/a2netcompat.h

@@ -37,16 +37,6 @@
 #include "a2io.h"
 
 #ifdef __MINGW32__
-# ifndef WINVER
-#  define WINVER 0x501u
-# endif // !WINVER
-# ifdef HAVE_WINSOCK2_H
-#  ifndef FD_SETSIZE
-#    define FD_SETSIZE 1024
-#  endif // !FD_SETSIZE
-#  include <winsock2.h>
-#  undef ERROR
-# endif // HAVE_WINSOCK2_H
 # ifdef HAVE_WS2TCPIP_H
 #  include <ws2tcpip.h>
 # endif // HAVE_WS2TCPIP_H

+ 12 - 2
src/common.h

@@ -51,8 +51,18 @@
 #ifdef __MINGW32__
 # define WIN32_LEAN_AND_MEAN
 # ifndef WINVER
-#  define WINVER 0x501u
-# endif // WINVER
+#  define WINVER 0x501
+# endif // !WINVER
+# ifndef _WIN32_WINNT
+#  define _WIN32_WINNT 0x501
+# endif // _WIN32_WINNT
+# ifdef HAVE_WINSOCK2_H
+#  ifndef FD_SETSIZE
+#    define FD_SETSIZE 1024
+#  endif // !FD_SETSIZE
+#  include <winsock2.h>
+#  undef ERROR
+# endif // HAVE_WINSOCK2_H
 # include <windows.h>
 #endif // __MINGW32__