aboutsummaryrefslogtreecommitdiffstats
path: root/code/qcommon/q_shared.h
diff options
context:
space:
mode:
authorthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-03-25 21:36:09 +0000
committerthilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea>2008-03-25 21:36:09 +0000
commitdac8a746a7f80b50834e750927335d8d1a00c1c1 (patch)
tree461e51086bf9daff9b03fdf6caf4513f19bff772 /code/qcommon/q_shared.h
parent37e48fb6ad3a6081c6bf226021b2aa30ad09673c (diff)
downloadioquake3-aero-dac8a746a7f80b50834e750927335d8d1a00c1c1.tar.gz
ioquake3-aero-dac8a746a7f80b50834e750927335d8d1a00c1c1.zip
- Replace vsprintf function in bg_lib.c with vsnprintf implementation started by Patrick Powell.
- Remove all calls to vsprintf in the engine and gamecode and replace them with calls to vsnprintf. git-svn-id: svn://svn.icculus.org/quake3/trunk@1277 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/qcommon/q_shared.h')
-rw-r--r--code/qcommon/q_shared.h50
1 files changed, 31 insertions, 19 deletions
diff --git a/code/qcommon/q_shared.h b/code/qcommon/q_shared.h
index 9959f27..8f5dbe4 100644
--- a/code/qcommon/q_shared.h
+++ b/code/qcommon/q_shared.h
@@ -92,9 +92,13 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
**********************************************************************/
+#ifdef Q3_VM
+
#include "../game/bg_lib.h"
-#ifndef Q3_VM
+typedef int intptr_t;
+
+#else
#include <assert.h>
#include <math.h>
@@ -106,30 +110,38 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include <ctype.h>
#include <limits.h>
+// vsnprintf is ISO/IEC 9899:1999
+// abstracting this to make it portable
+#ifdef _WIN32
+ #define Q_vsnprintf _vsnprintf
+ #define Q_snprintf _snprintf
+#else
+ #define Q_vsnprintf vsnprintf
+ #define Q_snprintf snprintf
+#endif
+
+#ifdef _MSC_VER
+ #include <io.h>
+
+ typedef __int64 int64_t;
+ typedef __int32 int32_t;
+ typedef __int16 int16_t;
+ typedef __int8 int8_t;
+ typedef unsigned __int64 uint64_t;
+ typedef unsigned __int32 uint32_t;
+ typedef unsigned __int16 uint16_t;
+ typedef unsigned __int8 uint8_t;
+#else
+ #include <stdint.h>
+#endif
+
#endif
+
#include "q_platform.h"
//=============================================================
-#ifdef Q3_VM
- typedef int intptr_t;
-#else
- #ifndef _MSC_VER
- #include <stdint.h>
- #else
- #include <io.h>
- typedef __int64 int64_t;
- typedef __int32 int32_t;
- typedef __int16 int16_t;
- typedef __int8 int8_t;
- typedef unsigned __int64 uint64_t;
- typedef unsigned __int32 uint32_t;
- typedef unsigned __int16 uint16_t;
- typedef unsigned __int8 uint8_t;
- #endif
-#endif
-
typedef unsigned char byte;
typedef enum {qfalse, qtrue} qboolean;