diff --git a/source/lib/sysdep/win/win.h b/source/lib/sysdep/win/win.h index 29323faa89..831d7c0ee8 100755 --- a/source/lib/sysdep/win/win.h +++ b/source/lib/sysdep/win/win.h @@ -22,13 +22,18 @@ #error "including win.h without _WIN32 defined" #endif +#include "config.h" + #include -// C99 -#define snprintf _snprintf -#define swprintf _snwprintf -#define vsnprintf _vsnprintf -#define vsnwprintf _vsnwprintf +// provide C99 *snprintf functions if compiler doesn't already +// (MinGW does, VC7.1 doesn't). +#ifndef HAVE_C99 +# define snprintf _snprintf +# define swprintf _snwprintf +# define vsnprintf _vsnprintf +# define vsnwprintf _vsnwprintf +#endif #include // wchar_t diff --git a/source/lib/sysdep/win/win_internal.h b/source/lib/sysdep/win/win_internal.h index 028c0e0a08..d34de6af25 100755 --- a/source/lib/sysdep/win/win_internal.h +++ b/source/lib/sysdep/win/win_internal.h @@ -133,6 +133,9 @@ typedef struct _MEMORYSTATUSEX // /////////////////////////////////////////////////////////////////////////////// +// MinGW headers are already fixed; only change on VC +#ifdef _MSC_VER + #ifndef NTSTATUS #define NTSTATUS long #endif @@ -229,16 +232,6 @@ typedef struct { #endif // WINVER < 0x500 -typedef struct _PROCESSOR_POWER_INFORMATION -{ - ULONG Number; - ULONG MaxMhz; - ULONG CurrentMhz; - ULONG MhzLimit; - ULONG MaxIdleState; - ULONG CurrentIdleState; -} PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION; - typedef struct _SYSTEM_POWER_INFORMATION { ULONG MaxIdlenessAllowed; @@ -251,6 +244,19 @@ typedef struct _SYSTEM_POWER_INFORMATION #define PO_TZ_INVALID_MODE 0 // The system does not support CPU throttling, // or there is no thermal zone defined [..] +#endif // #ifdef _MSC_VER + +// neither VC7.1 nor MinGW define this +typedef struct _PROCESSOR_POWER_INFORMATION +{ + ULONG Number; + ULONG MaxMhz; + ULONG CurrentMhz; + ULONG MhzLimit; + ULONG MaxIdleState; + ULONG CurrentIdleState; +} PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION; + /////////////////////////////////////////////////////////////////////////////// // diff --git a/source/lib/sysdep/win/wposix.h b/source/lib/sysdep/win/wposix.h index bc28f442b1..a48d866b92 100755 --- a/source/lib/sysdep/win/wposix.h +++ b/source/lib/sysdep/win/wposix.h @@ -122,7 +122,10 @@ EWOULDBLOCK // Operation would block (may be the same value as EAGAIN]). // sys/stat.h // +// already defined by MinGW +#ifdef _MSC_VER typedef unsigned int mode_t; +#endif // VC libc includes stat, but it's quite slow. // we implement our own, but use the CRT struct definition. diff --git a/source/lib/sysdep/win/wposix_types.h b/source/lib/sysdep/win/wposix_types.h index aa75070723..9d98bbe9cd 100644 --- a/source/lib/sysdep/win/wposix_types.h +++ b/source/lib/sysdep/win/wposix_types.h @@ -5,7 +5,12 @@ typedef char int8_t; typedef short int16_t; + +// already defined by MinGW +#ifdef _MSC_VER typedef int int32_t; +#endif + #if defined(_MSC_VER) || defined(__INTEL_COMPILER) || defined(__LCC__) typedef __int64 int64_t; #elif defined(__GNUC__) || defined(__MWERKS__) || defined(__SUNPRO_C) || defined(__DMC__)