From c2fa09af6a98d13d3eedf777f93b00ee666dc324 Mon Sep 17 00:00:00 2001 From: blacksirius Date: Sun, 3 Jun 2012 17:55:38 +0000 Subject: cleaned up windows header usage (added one central file to use windows / winapi specific stuff, to be able to set the appropriate flags before including it correctly) Note: this may screw up mingw or cygwin building, ill fix it later... git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16219 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/core.c | 2 +- src/common/lock.c | 2 +- src/common/random.c | 3 +-- src/common/showmsg.c | 3 +-- src/common/socket.c | 3 +-- src/common/socket.h | 3 +-- src/common/sql.c | 2 +- src/common/timer.c | 3 +-- src/common/utils.c | 3 +-- src/common/winapi.h | 36 ++++++++++++++++++++++++++++++++++++ 10 files changed, 45 insertions(+), 15 deletions(-) create mode 100644 src/common/winapi.h (limited to 'src/common') diff --git a/src/common/core.c b/src/common/core.c index bde1d9c0b..22d36eaab 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -18,7 +18,7 @@ #ifndef _WIN32 #include #else -#include // Console close event handling +#include "../common/winapi.h" // Console close event handling #endif diff --git a/src/common/lock.c b/src/common/lock.c index 643b86e5c..d01a54ca4 100644 --- a/src/common/lock.c +++ b/src/common/lock.c @@ -12,7 +12,7 @@ #ifndef WIN32 #include #else -#include +#include "../common/winapi.h" #endif // 書き込みファイルの保護処理 diff --git a/src/common/random.c b/src/common/random.c index 224b71fdb..367d26cfe 100644 --- a/src/common/random.c +++ b/src/common/random.c @@ -5,8 +5,7 @@ #include "../common/timer.h" // gettick #include "random.h" #if defined(WIN32) - #define WIN32_LEAN_AND_MEAN - #include + #include "../common/winapi.h" #elif defined(HAVE_GETPID) || defined(HAVE_GETTID) #include #include diff --git a/src/common/showmsg.c b/src/common/showmsg.c index 3beb55b72..c4271eda8 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -15,8 +15,7 @@ #include "libconfig.h" #ifdef WIN32 - #define WIN32_LEAN_AND_MEAN - #include + #include "../common/winapi.h" #ifdef DEBUGLOGMAP #define DEBUGLOGPATH "log\\map-server.log" diff --git a/src/common/socket.c b/src/common/socket.c index 9f781f7b7..f8e957788 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -15,8 +15,7 @@ #include #ifdef WIN32 - #include - #include + #include "../common/winapi.h" #else #include #include diff --git a/src/common/socket.h b/src/common/socket.h index a5d519d0e..3c6cebf0b 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -7,8 +7,7 @@ #include "../common/cbasetypes.h" #ifdef WIN32 - #define WIN32_LEAN_AND_MEAN // otherwise winsock2.h includes full windows.h - #include + #include "../common/winapi.h" typedef long in_addr_t; #else #include diff --git a/src/common/sql.c b/src/common/sql.c index edac5a297..800aa89b0 100644 --- a/src/common/sql.c +++ b/src/common/sql.c @@ -9,7 +9,7 @@ #include "sql.h" #ifdef WIN32 -#include +#include "../common/winapi.h" #endif #include #include // strlen/strnlen/memcpy/memset diff --git a/src/common/timer.c b/src/common/timer.c index 32bc30520..c239a9d70 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -14,8 +14,7 @@ #include #ifdef WIN32 -#define WIN32_LEAN_AND_MEAN -#include // GetTickCount() +#include "../common/winapi.h" // GetTickCount() #else #include #include // struct timeval, gettimeofday() diff --git a/src/common/utils.c b/src/common/utils.c index 08ac8db15..296df7e70 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -15,8 +15,7 @@ #include // floor() #ifdef WIN32 - #include - #include + #include "../common/winapi.h" #ifndef F_OK #define F_OK 0x0 #endif /* F_OK */ diff --git a/src/common/winapi.h b/src/common/winapi.h new file mode 100644 index 000000000..7ce555049 --- /dev/null +++ b/src/common/winapi.h @@ -0,0 +1,36 @@ +#pragma once + + +#define STRICT +#define NTDDI_VERSION NTDDI_WIN2K +#define _WIN32_WINNT 0x0500 +#define WINVER 0x0500 +#define _WIN32_IE 0x0600 +#define WIN32_LEAN_AND_MEAN +#define NOCOMM +#define NOKANJI +#define NOHELP +#define NOMCX +#define NOCLIPBOARD +#define NOCOLOR +#define NONLS +#define NOMEMMGR +#define NOMETAFILE +#define NOOPENFILE +#define NOSERVICE +#define NOSOUND +#define NOTEXTMETRIC + + +#define _CRT_SECURE_NO_WARNINGS +#define _CRT_NONSTDC_NO_WARNINGS + +#include +#include +#include +#include +#include +#include +#include + + -- cgit v1.2.3-60-g2f50