mirror of https://github.com/AxioDL/tinyxml2.git
Don't use -1 as buffer length
This commit is contained in:
parent
91f2dcfb5c
commit
687bf8211f
10
tinyxml2.cpp
10
tinyxml2.cpp
|
@ -2041,12 +2041,16 @@ void XMLPrinter::Print( const char* format, ... )
|
|||
#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
|
||||
#if defined(WINCE)
|
||||
int len = 512;
|
||||
do {
|
||||
for (;;) {
|
||||
len = len*2;
|
||||
char* str = new char[len]();
|
||||
len = _vsnprintf(str, len, format, va);
|
||||
const int required = _vsnprintf(str, len, format, va);
|
||||
delete[] str;
|
||||
}while (len < 0);
|
||||
if ( required != -1 ) {
|
||||
len = required;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
int len = _vscprintf( format, va );
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue