|
|
@ -67,10 +67,10 @@ std::string stl_vsprintf(const char *fmt, va_list args) {
|
|
|
|
return std::string(&buf[0], rsz); /* Whole string fits to a single line buffer */
|
|
|
|
return std::string(&buf[0], rsz); /* Whole string fits to a single line buffer */
|
|
|
|
std::string rv;
|
|
|
|
std::string rv;
|
|
|
|
// Allocate enough memory for the output and null termination
|
|
|
|
// Allocate enough memory for the output and null termination
|
|
|
|
rv.resize(rsz+1);
|
|
|
|
rv.resize(rsz);
|
|
|
|
rsz = vsnprintf(&rv[0], rv.size(), fmt, args);
|
|
|
|
rsz = vsnprintf(&rv[0], rv.size()+1, fmt, args);
|
|
|
|
if (rsz + 1 < static_cast<int>(rv.size()))
|
|
|
|
if (rsz < static_cast<int>(rv.size()))
|
|
|
|
rv.resize(std::max(rsz+1,0));
|
|
|
|
rv.resize(std::max(rsz,0));
|
|
|
|
return rv;
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|