From ce9eec5cb2a4f6206e0c8900078e187715a3ff06 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 25 May 2013 23:28:28 +0900 Subject: [PATCH] Include winsock2.h before windows.h --- src/Platform.cc | 14 +------------- src/a2netcompat.h | 10 ---------- src/common.h | 14 ++++++++++++-- 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/src/Platform.cc b/src/Platform.cc index 298294ae..f91a14f4 100644 --- a/src/Platform.cc +++ b/src/Platform.cc @@ -41,19 +41,6 @@ #include -#ifdef HAVE_WINSOCK2_H - -#ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x501u -#endif // _WIN32_WINNT -#include -#undef ERROR -#ifdef HAVE_WS2TCPIP_H -# include -#endif // HAVE_WS2TCPIP_H - -#endif // HAVE_WINSOCK2_H - #ifdef HAVE_OPENSSL # include # include @@ -69,6 +56,7 @@ # include #endif // ENABLE_ASYNC_DNS +#include "a2netcompat.h" #include "DlAbortEx.h" #include "message.h" #include "fmt.h" diff --git a/src/a2netcompat.h b/src/a2netcompat.h index 46af621b..5864277b 100644 --- a/src/a2netcompat.h +++ b/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 -# undef ERROR -# endif // HAVE_WINSOCK2_H # ifdef HAVE_WS2TCPIP_H # include # endif // HAVE_WS2TCPIP_H diff --git a/src/common.h b/src/common.h index 07cdbf2e..faf79620 100644 --- a/src/common.h +++ b/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 +# undef ERROR +# endif // HAVE_WINSOCK2_H # include #endif // __MINGW32__