From 933871548914dd56210e5440e64d9f78c071ea43 Mon Sep 17 00:00:00 2001 From: TimeServ Date: Thu, 18 May 2006 02:54:22 +0000 Subject: [PATCH] fix snprintf for msvc8 compiled builds git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2286 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/quakedef.h | 3 ++- engine/common/common.c | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/engine/client/quakedef.h b/engine/client/quakedef.h index 4eeb8e37d..e1744f912 100644 --- a/engine/client/quakedef.h +++ b/engine/client/quakedef.h @@ -188,7 +188,8 @@ extern "C" { #ifdef _WIN32 #if (_MSC_VER >= 1400) //with MSVC 8, use MS extensions -#define snprintf sprintf_s +#define snprintf linuxlike_snprintf_vc8 +int VARGS linuxlike_snprintf_vc8(char *buffer, int size, const char *format, ...); #define vsnprintf(a, b, c, d) vsnprintf_s(a, b, _TRUNCATE, c, d) #else //msvc crap diff --git a/engine/common/common.c b/engine/common/common.c index 4f3e8c304..c5d7a7a84 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -3112,6 +3112,18 @@ int VARGS linuxlike_vsnprintf(char *buffer, int size, const char *format, va_lis return ret; } +#else +int VARGS linuxlike_snprintf_vc8(char *buffer, int size, const char *format, ...) +{ + int ret; + va_list argptr; + + va_start (argptr, format); + ret = vsnprintf_s (buffer,size, _TRUNCATE, format,argptr); + va_end (argptr); + + return ret; +} #endif #endif