Fix MS VC build

This commit is contained in:
Stas Degteff 2011-02-22 07:45:45 +00:00
parent b5027d74e0
commit cb9a56766d
2 changed files with 4 additions and 3 deletions

View File

@ -27,10 +27,11 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
// ------------------------------------------------------------------
#include <gutlmisc.h> #include <gutlmisc.h>
#include <gfilutil.h> #include <gfilutil.h>
#include <gdbgerr.h> #include <gdbgerr.h>
#include <string.h> #include <gstrall.h>
// ------------------------------------------------------------------ // ------------------------------------------------------------------

View File

@ -774,9 +774,9 @@ int gsprintf(TCHAR* buffer, size_t sizeOfBuffer, const TCHAR* __file, int __line
*/ */
# if __VISUAL_C_NOT_LESS(10,00) // defined HAVE__VSTPRINTF // _vsnprintf() exist in VS6 and deprecated in VS2005 # if __VISUAL_C_NOT_LESS(10,00) // defined HAVE__VSTPRINTF // _vsnprintf() exist in VS6 and deprecated in VS2005
char * b1[sizeOfBuffer+1]; char * b1 = new char[sizeOfBuffer+1];
const size_t endOfBuffer = sizeOfBuffer-1; const size_t endOfBuffer = sizeOfBuffer-1;
ret = _vsnprintf(b1, sizeof(b1), format, argptr); ret = _vsnprintf(b1, sizeOfBuffer+1, format, argptr);
if (ret == -1 || ret >= sizeOfBuffer) // Microsoft implementation returns -1 when buffer overflow. if (ret == -1 || ret >= sizeOfBuffer) // Microsoft implementation returns -1 when buffer overflow.
{ {
strncpy(buffer,b1,endOfBuffer); strncpy(buffer,b1,endOfBuffer);