From 6c60c09a2c296f51c32b0b2ac98a55e30df51e3b Mon Sep 17 00:00:00 2001 From: anders_k Date: Thu, 25 Jul 2013 22:00:53 +0000 Subject: [PATCH] VS2008 does not like the vsnwprintf(INT_MAX) hack, use _vscwprintf if it exists git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6396 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/util.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Source/util.cpp b/Source/util.cpp index 4a0735a7..959a1391 100644 --- a/Source/util.cpp +++ b/Source/util.cpp @@ -48,6 +48,7 @@ namespace Apple { // defines struct section #include // for assert #include #include +#include using namespace std; @@ -577,10 +578,14 @@ tstring lowercase(const tstring &str) { size_t ExpandoStrFmtVaList(wchar_t*Stack, size_t cchStack, wchar_t**ppMalloc, const wchar_t*FmtStr, va_list Args) { #ifdef _WIN32 -// For _vsnwprintf, the \0 terminator is not part of the size -#define ExpandoStrFmtVaList_vsnwprintf(d,c,f,v) _vsnwprintf((d),(c)?(c)-1:0,(f),(v)) +// For _vsnwprintf, the \0 terminator is not part of the input size +# if _MSC_VER <= 1310 +# define ExpandoStrFmtVaList_vsnwprintf(d,c,f,v) _vsnwprintf((d),(c)?(c)-1:0,(f),(v)) // Allow INT_MAX hack on MinGW and older versions of VC that don't have _vscwprintf +# else +# define ExpandoStrFmtVaList_vsnwprintf(d,c,f,v) ( INT_MAX==(c) ? _vscwprintf((f),(v)) : _vsnwprintf((d),(c)?(c)-1:0,(f),(v)) ) +# endif #else -#define ExpandoStrFmtVaList_vsnwprintf vswprintf +# define ExpandoStrFmtVaList_vsnwprintf vswprintf #endif #if defined(_ISOC99_SOURCE) || _POSIX_C_SOURCE >= 200112L const bool cansizecalc = true, msvcbackdoor = false;