(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
This commit is contained in:
darkvater 2004-12-23 22:31:46 +00:00
parent dda14faac5
commit b249954538
4 changed files with 29 additions and 15 deletions

View File

@ -162,7 +162,7 @@ static void DedicatedHandleKeyInput()
else { else {
printf("\n"); printf("\n");
IConsoleCmdExec(input_line); IConsoleCmdExec(input_line);
sprintf(input_line, ""); input_line[0] = '\0';
} }
} }
#endif #endif

View File

@ -9,19 +9,23 @@
// Windows stuff // Windows stuff
#if defined(WIN32) #if defined(WIN32)
# include <windows.h> #include <windows.h>
# include <winsock2.h> #include <winsock2.h>
# include <ws2tcpip.h> #include <ws2tcpip.h>
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma comment (lib, "ws2_32.lib") #pragma comment (lib, "ws2_32.lib")
#endif //_MSC_VER #endif //_MSC_VER
# define ENABLE_NETWORK // On windows, the network is always enabled #if ! (defined(__MINGW32__) || defined(__CYGWIN__))
# define GET_LAST_ERROR() WSAGetLastError() #define ENABLE_NETWORK // On windows, the network is always enabled
# define EWOULDBLOCK WSAEWOULDBLOCK // 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.. // Windows has some different names for some types..
typedef SSIZE_T ssize_t;
typedef unsigned long in_addr_t; typedef unsigned long in_addr_t;
typedef INTERFACE_INFO IFREQ; typedef INTERFACE_INFO IFREQ;
#endif // WIN32 #endif // WIN32

View File

@ -93,6 +93,10 @@
# include <malloc.h> # include <malloc.h>
#endif #endif
#if defined(__MINGW32__) || defined(__CYGWIN__)
#include <malloc.h> // alloca()
#endif
// Stuff for MSVC // Stuff for MSVC
#if defined(_MSC_VER) #if defined(_MSC_VER)
# include <malloc.h> // alloca() # include <malloc.h> // alloca()

18
win32.c
View File

@ -35,7 +35,7 @@ static struct {
static HINSTANCE _inst; static HINSTANCE _inst;
static bool _has_console; static bool _has_console;
#if defined(MINGW32) || defined(__CYGWIN__) #if defined(__MINGW32__) || defined(__CYGWIN__)
#define __TIMESTAMP__ __DATE__ __TIME__ #define __TIMESTAMP__ __DATE__ __TIME__
#endif #endif
@ -993,6 +993,8 @@ bool LoadLibraryList(void **proc, const char *dll)
return true; return true;
} }
#ifdef _MSC_VER
static const char *_exception_string; static const char *_exception_string;
static void *_safe_esp; static void *_safe_esp;
static char *_crash_msg; static char *_crash_msg;
@ -1012,19 +1014,14 @@ void ShowOSErrorBox(const char *buf)
*(byte*)0 = 0; *(byte*)0 = 0;
} }
#endif #endif
} }
#ifdef _MSC_VER
typedef struct DebugFileInfo { typedef struct DebugFileInfo {
uint32 size; uint32 size;
uint32 crc32; uint32 crc32;
SYSTEMTIME file_time; SYSTEMTIME file_time;
} DebugFileInfo; } DebugFileInfo;
static uint32 *_crc_table; static uint32 *_crc_table;
static void MakeCRCTable(uint32 *table) { static void MakeCRCTable(uint32 *table) {
@ -1462,6 +1459,15 @@ static void Win32InitializeExceptions()
SetUnhandledExceptionFilter(ExceptionHandler); 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 #endif
static char *_fios_path; static char *_fios_path;