mirror of
https://github.com/AxioDL/tinyxml2.git
synced 2025-05-14 19:31:23 +00:00
Merge branch 'master' of https://github.com/pzychotic/tinyxml2 into pzychotic-master
This commit is contained in:
commit
8f7b87b323
16
tinyxml2.cpp
16
tinyxml2.cpp
@ -1855,28 +1855,16 @@ void XMLPrinter::Print( const char* format, ... )
|
|||||||
vfprintf( _fp, format, va );
|
vfprintf( _fp, format, va );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// This seems brutally complex. Haven't figured out a better
|
|
||||||
// way on windows.
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
int len = -1;
|
int len = _vscprintf( format, va );
|
||||||
int expand = 1000;
|
|
||||||
while ( len < 0 ) {
|
|
||||||
len = vsnprintf_s( _accumulator.Mem(), _accumulator.Capacity(), _TRUNCATE, format, va );
|
|
||||||
if ( len < 0 ) {
|
|
||||||
expand *= 3/2;
|
|
||||||
_accumulator.PushArr( expand );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
char* p = _buffer.PushArr( len ) - 1;
|
|
||||||
memcpy( p, _accumulator.Mem(), len+1 );
|
|
||||||
#else
|
#else
|
||||||
int len = vsnprintf( 0, 0, format, va );
|
int len = vsnprintf( 0, 0, format, va );
|
||||||
|
#endif
|
||||||
// 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;
|
||||||
vsnprintf( p, len+1, format, va );
|
vsnprintf( p, len+1, format, va );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
va_end( va );
|
va_end( va );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user