fix for msvc7.1

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@454 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
syntheticpp 2006-01-09 07:51:44 +00:00
parent dd83739b20
commit d2372341f3
2 changed files with 16 additions and 4 deletions

View file

@ -347,12 +347,19 @@ namespace Loki
} }
memcpy(fmtBuf, fmt, (format_ - fmt) * sizeof(Char)); memcpy(fmtBuf, fmt, (format_ - fmt) * sizeof(Char));
fmtBuf[format_ - fmt] = 0; fmtBuf[format_ - fmt] = 0;
const int stored =
#ifdef _MSC_VER #ifdef _MSC_VER
const int stored = _snprintf_s(resultBuf, #if _MSC_VER < 1400
_snprintf
#else #else
const int stored = snprintf(resultBuf, _snprintf_s
#endif
#else
snprintf
#endif #endif
sizeof(resultBuf) / sizeof(Char), fmtBuf, n); (resultBuf, sizeof(resultBuf) / sizeof(Char), fmtBuf, n);
if (stored < 0) { if (stored < 0) {
result_ = -1; result_ = -1;
return; return;

View file

@ -17,8 +17,13 @@
#include "../SmallObj/timer.h" #include "../SmallObj/timer.h"
#if defined(_MSC_VER) #if defined(_MSC_VER)
#define sprintf sprintf_s #if _MSC_VER >= 1400
#define sprintf sprintf_s
#define _snprintf _snprintf_s #define _snprintf _snprintf_s
else
#define sprintf sprintf
#define _snprintf _snprintf
#endif
#endif #endif
using namespace std; using namespace std;