fix implementation of much simpler visual studio printing

This commit is contained in:
Lee Thomason 2014-03-16 10:32:27 -07:00
parent 8f7b87b323
commit a0744c8dca
1 changed files with 7 additions and 3 deletions

View File

@ -1855,7 +1855,7 @@ void XMLPrinter::Print( const char* format, ... )
vfprintf( _fp, format, va );
}
else {
#ifdef _MSC_VER
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
int len = _vscprintf( format, va );
#else
int len = vsnprintf( 0, 0, format, va );
@ -1863,8 +1863,12 @@ void XMLPrinter::Print( const char* format, ... )
// Close out and re-start the va-args
va_end( va );
va_start( va, format );
char* p = _buffer.PushArr( len ) - 1;
vsnprintf( p, len+1, format, va );
char* p = _buffer.PushArr( len ) - 1; // back up over the null terminator.
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
vsnprintf_s( p, len+1, _TRUNCATE, format, va );
#else
vsnprintf( p, len+1, format, va );
#endif
}
va_end( va );
}