mirror of https://github.com/AxioDL/tinyxml2.git
fix implementation of much simpler visual studio printing
This commit is contained in:
parent
8f7b87b323
commit
a0744c8dca
10
tinyxml2.cpp
10
tinyxml2.cpp
|
@ -1855,7 +1855,7 @@ void XMLPrinter::Print( const char* format, ... )
|
||||||
vfprintf( _fp, format, va );
|
vfprintf( _fp, format, va );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#ifdef _MSC_VER
|
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
|
||||||
int len = _vscprintf( format, va );
|
int len = _vscprintf( format, va );
|
||||||
#else
|
#else
|
||||||
int len = vsnprintf( 0, 0, format, va );
|
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
|
// Close out and re-start the va-args
|
||||||
va_end( va );
|
va_end( va );
|
||||||
va_start( va, format );
|
va_start( va, format );
|
||||||
char* p = _buffer.PushArr( len ) - 1;
|
char* p = _buffer.PushArr( len ) - 1; // back up over the null terminator.
|
||||||
vsnprintf( p, len+1, format, va );
|
#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 );
|
va_end( va );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue