From b2499545385caeb4d9ccc8b8d1c8737441ae5ae9 Mon Sep 17 00:00:00 2001 From: darkvater Date: Thu, 23 Dec 2004 22:31:46 +0000 Subject: (svn r1266) -Fix: fix some cygwin/mingw warnings -Note: when compiling with MinGW (-mno-cygwin) __MINGW32__ is defined; when compiling without it __CYGWIN32__ is defined. You need to set either -mno-cygwin (MinGW) or -mwin32 (Cygwin) to have WIN32 defined --- dedicated.c | 2 +- network_core.h | 20 ++++++++++++-------- stdafx.h | 4 ++++ win32.c | 18 ++++++++++++------ 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/dedicated.c b/dedicated.c index f34c26ea0..ed9df3b58 100644 --- a/dedicated.c +++ b/dedicated.c @@ -162,7 +162,7 @@ static void DedicatedHandleKeyInput() else { printf("\n"); IConsoleCmdExec(input_line); - sprintf(input_line, ""); + input_line[0] = '\0'; } } #endif diff --git a/network_core.h b/network_core.h index d6a408c33..bf29116ec 100644 --- a/network_core.h +++ b/network_core.h @@ -9,19 +9,23 @@ // Windows stuff #if defined(WIN32) -# include -# include -# include +#include +#include +#include #ifdef _MSC_VER -#pragma comment (lib, "ws2_32.lib") + #pragma comment (lib, "ws2_32.lib") #endif //_MSC_VER -# define ENABLE_NETWORK // On windows, the network is always enabled -# define GET_LAST_ERROR() WSAGetLastError() -# define EWOULDBLOCK WSAEWOULDBLOCK +#if ! (defined(__MINGW32__) || defined(__CYGWIN__)) + #define ENABLE_NETWORK // On windows, the network is always enabled + // Windows has some different names for some types.. + typedef SSIZE_T ssize_t; +#endif + +#define GET_LAST_ERROR() WSAGetLastError() +#define EWOULDBLOCK WSAEWOULDBLOCK // Windows has some different names for some types.. -typedef SSIZE_T ssize_t; typedef unsigned long in_addr_t; typedef INTERFACE_INFO IFREQ; #endif // WIN32 diff --git a/stdafx.h b/stdafx.h index 693979970..67401040a 100644 --- a/stdafx.h +++ b/stdafx.h @@ -93,6 +93,10 @@ # include #endif +#if defined(__MINGW32__) || defined(__CYGWIN__) +#include // alloca() +#endif + // Stuff for MSVC #if defined(_MSC_VER) # include // alloca() diff --git a/win32.c b/win32.c index 8e07c41d1..4366d62a7 100644 --- a/win32.c +++ b/win32.c @@ -35,7 +35,7 @@ static struct { static HINSTANCE _inst; static bool _has_console; -#if defined(MINGW32) || defined(__CYGWIN__) +#if defined(__MINGW32__) || defined(__CYGWIN__) #define __TIMESTAMP__ __DATE__ __TIME__ #endif @@ -993,6 +993,8 @@ bool LoadLibraryList(void **proc, const char *dll) return true; } +#ifdef _MSC_VER + static const char *_exception_string; static void *_safe_esp; static char *_crash_msg; @@ -1012,19 +1014,14 @@ void ShowOSErrorBox(const char *buf) *(byte*)0 = 0; } #endif - } -#ifdef _MSC_VER - typedef struct DebugFileInfo { uint32 size; uint32 crc32; SYSTEMTIME file_time; } DebugFileInfo; - - static uint32 *_crc_table; static void MakeCRCTable(uint32 *table) { @@ -1462,6 +1459,15 @@ static void Win32InitializeExceptions() SetUnhandledExceptionFilter(ExceptionHandler); } +#else +/* Get rid of unused variable warnings.. ShowOSErrorBox + * is now used twice, once in MSVC, and once in all other Win + * compilers (cygwin, mingw, etc.) */ +void ShowOSErrorBox(const char *buf) +{ + MyShowCursor(true); + MessageBoxA(GetActiveWindow(), buf, "Error!", MB_ICONSTOP); +} #endif static char *_fios_path; -- cgit v1.2.3-70-g09d2