|
|
@ -255,8 +255,7 @@ int my_snprintf(char* buffer, size_t limit, const char* format, ...) |
|
|
|
return ret; |
|
|
|
return ret; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string strprintf(const std::string &format, ...) |
|
|
|
string strprintf(const char* format, ...) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
char buffer[50000]; |
|
|
|
char buffer[50000]; |
|
|
|
char* p = buffer; |
|
|
|
char* p = buffer; |
|
|
@ -266,7 +265,7 @@ string strprintf(const char* format, ...) |
|
|
|
{ |
|
|
|
{ |
|
|
|
va_list arg_ptr; |
|
|
|
va_list arg_ptr; |
|
|
|
va_start(arg_ptr, format); |
|
|
|
va_start(arg_ptr, format); |
|
|
|
ret = _vsnprintf(p, limit, format, arg_ptr); |
|
|
|
ret = _vsnprintf(p, limit, format.c_str(), arg_ptr); |
|
|
|
va_end(arg_ptr); |
|
|
|
va_end(arg_ptr); |
|
|
|
if (ret >= 0 && ret < limit) |
|
|
|
if (ret >= 0 && ret < limit) |
|
|
|
break; |
|
|
|
break; |
|
|
@ -283,14 +282,13 @@ string strprintf(const char* format, ...) |
|
|
|
return str; |
|
|
|
return str; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool error(const std::string &format, ...) |
|
|
|
bool error(const char* format, ...) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
char buffer[50000]; |
|
|
|
char buffer[50000]; |
|
|
|
int limit = sizeof(buffer); |
|
|
|
int limit = sizeof(buffer); |
|
|
|
va_list arg_ptr; |
|
|
|
va_list arg_ptr; |
|
|
|
va_start(arg_ptr, format); |
|
|
|
va_start(arg_ptr, format); |
|
|
|
int ret = _vsnprintf(buffer, limit, format, arg_ptr); |
|
|
|
int ret = _vsnprintf(buffer, limit, format.c_str(), arg_ptr); |
|
|
|
va_end(arg_ptr); |
|
|
|
va_end(arg_ptr); |
|
|
|
if (ret < 0 || ret >= limit) |
|
|
|
if (ret < 0 || ret >= limit) |
|
|
|
{ |
|
|
|
{ |
|
|
|