Don't use -1 as buffer length

This commit is contained in:
Dmitry-Me 2015-06-08 18:06:44 +03:00
parent 91f2dcfb5c
commit 687bf8211f
1 changed files with 7 additions and 3 deletions

View File

@ -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