git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@258 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
syntheticpp 2005-09-24 23:09:13 +00:00
parent c6e143aba7
commit 79f4f270a5
2 changed files with 9 additions and 0 deletions

View file

@ -316,7 +316,11 @@ private:
}
memcpy(fmtBuf, fmt, (format_ - fmt) * sizeof(Char));
fmtBuf[format_ - fmt] = 0;
#ifdef _MSC_VER
const int stored = _snprintf(resultBuf,
#else
const int stored = snprintf(resultBuf,
#endif
sizeof(resultBuf) / sizeof(Char), fmtBuf, n);
if (stored < 0) {
result_ = -1;

View file

@ -55,7 +55,12 @@ void TestCase(const string& fmt, T value) {
char buf[4096];
std::string s;
const int i1 = SPrintf(s, fmt.c_str())(value);
#ifdef _MSC_VER
const int i2 = _snprintf(buf, sizeof(buf), fmt.c_str(), value);
#else
const int i2 = snprintf(buf, sizeof(buf), fmt.c_str(), value);
#endif
if (i1 != i2 || s != buf) {
cout <<
"\nReference: " << i2 <<