Skip to content

Commit d035470

Browse files
committed
Update tinyxml to v2.0.2.
1 parent fc54e6a commit d035470

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

externals/tinyxml/tinyxml2.cpp

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,27 +1855,19 @@ void XMLPrinter::Print( const char* format, ... )
18551855
vfprintf( _fp, format, va );
18561856
}
18571857
else {
1858-
// This seems brutally complex. Haven't figured out a better
1859-
// way on windows.
1860-
#ifdef _MSC_VER
1861-
int len = -1;
1862-
int expand = 1000;
1863-
while ( len < 0 ) {
1864-
len = vsnprintf_s( _accumulator.Mem(), _accumulator.Capacity(), _TRUNCATE, format, va );
1865-
if ( len < 0 ) {
1866-
expand *= 3/2;
1867-
_accumulator.PushArr( expand );
1868-
}
1869-
}
1870-
char* p = _buffer.PushArr( len ) - 1;
1871-
memcpy( p, _accumulator.Mem(), len+1 );
1858+
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
1859+
int len = _vscprintf( format, va );
18721860
#else
18731861
int len = vsnprintf( 0, 0, format, va );
1862+
#endif
18741863
// Close out and re-start the va-args
18751864
va_end( va );
18761865
va_start( va, format );
1877-
char* p = _buffer.PushArr( len ) - 1;
1878-
vsnprintf( p, len+1, format, va );
1866+
char* p = _buffer.PushArr( len ) - 1; // back up over the null terminator.
1867+
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
1868+
vsnprintf_s( p, len+1, _TRUNCATE, format, va );
1869+
#else
1870+
vsnprintf( p, len+1, format, va );
18791871
#endif
18801872
}
18811873
va_end( va );

externals/tinyxml/tinyxml2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ inline int TIXML_SNPRINTF( char* buffer, size_t size, const char* format, ... )
121121
*/
122122
static const int TIXML2_MAJOR_VERSION = 2;
123123
static const int TIXML2_MINOR_VERSION = 0;
124-
static const int TIXML2_PATCH_VERSION = 0;
124+
static const int TIXML2_PATCH_VERSION = 2;
125125

126126
namespace tinyxml2
127127
{

0 commit comments

Comments
 (0)