mirror of https://github.com/axmolengine/axmol.git
see issue: https://github.com/cocos2d/cocos2d-x/issues/18724
This commit is contained in:
parent
542f064c37
commit
6317e35f01
|
@ -47,7 +47,7 @@ std::string format(const char* format, ...)
|
||||||
std::string buffer(CC_VSNPRINTF_BUFFER_LENGTH, '\0');
|
std::string buffer(CC_VSNPRINTF_BUFFER_LENGTH, '\0');
|
||||||
|
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
int nret = vsnprintf(&buffer.front(), buffer.length(), format, args);
|
int nret = vsnprintf(&buffer.front(), buffer.length() + 1, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if (nret >= 0) {
|
if (nret >= 0) {
|
||||||
|
@ -58,7 +58,7 @@ std::string format(const char* format, ...)
|
||||||
buffer.resize(nret);
|
buffer.resize(nret);
|
||||||
|
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
nret = vsnprintf(&buffer.front(), buffer.length(), format, args);
|
nret = vsnprintf(&buffer.front(), buffer.length() + 1, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
assert(nret == buffer.length());
|
assert(nret == buffer.length());
|
||||||
|
@ -70,7 +70,7 @@ std::string format(const char* format, ...)
|
||||||
buffer.resize(buffer.length() * 3 / 2);
|
buffer.resize(buffer.length() * 3 / 2);
|
||||||
|
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
nret = vsnprintf(&buffer.front(), buffer.length(), format, args);
|
nret = vsnprintf(&buffer.front(), buffer.length() + 1, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
} while (nret < 0);
|
} while (nret < 0);
|
||||||
|
|
Loading…
Reference in New Issue