mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2025-02-16 17:11:15 +00:00
Fix Q_vsnprintf for mingw-w64
By default mingw-w64 uses Microsoft's broken _vsnprintf() in msvcrt.dll. It can be overriden by defining __USE_MINGW_ANSI_STDIO but let's just use the same behavior for both MSVC and mingw-w64. Reported by @birdstakes.
This commit is contained in:
parent
ad10e6610c
commit
83119a990a
2 changed files with 8 additions and 5 deletions
|
@ -746,13 +746,14 @@ qboolean Q_isintegral( float f )
|
||||||
return (int)f == f;
|
return (int)f == f;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _WIN32
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
Q_vsnprintf
|
Q_vsnprintf
|
||||||
|
|
||||||
Special wrapper function for Microsoft's broken _vsnprintf() function.
|
Special wrapper function for Microsoft's broken _vsnprintf() function.
|
||||||
MinGW comes with its own snprintf() which is not broken.
|
MinGW comes with its own vsnprintf() which is not broken. mingw-w64
|
||||||
|
however, uses Microsoft's broken _vsnprintf() function.
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -177,13 +177,15 @@ typedef int intptr_t;
|
||||||
typedef unsigned __int32 uint32_t;
|
typedef unsigned __int32 uint32_t;
|
||||||
typedef unsigned __int16 uint16_t;
|
typedef unsigned __int16 uint16_t;
|
||||||
typedef unsigned __int8 uint8_t;
|
typedef unsigned __int8 uint8_t;
|
||||||
|
#else
|
||||||
|
#include <stdint.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
// vsnprintf is ISO/IEC 9899:1999
|
// vsnprintf is ISO/IEC 9899:1999
|
||||||
// abstracting this to make it portable
|
// abstracting this to make it portable
|
||||||
int Q_vsnprintf(char *str, size_t size, const char *format, va_list ap);
|
int Q_vsnprintf(char *str, size_t size, const char *format, va_list ap);
|
||||||
#else
|
#else
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define Q_vsnprintf vsnprintf
|
#define Q_vsnprintf vsnprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue