update limonp

This commit is contained in:
wyy 2014-09-18 00:05:43 +08:00
parent 23aee266c3
commit da1b9e0c1c
2 changed files with 1 additions and 22 deletions

View File

@ -57,7 +57,7 @@ namespace Husky
LogError("do_POST failed."); LogError("do_POST failed.");
break; break;
} }
string_format(strSnd, HTTP_FORMAT, CHARSET_UTF8, strRetByHandler.length(), strRetByHandler.c_str()); strSnd = string_format(HTTP_FORMAT, CHARSET_UTF8, strRetByHandler.length(), strRetByHandler.c_str());
if(!_send(_sockfd, strSnd)) if(!_send(_sockfd, strSnd))
{ {

View File

@ -26,27 +26,6 @@
namespace Limonp namespace Limonp
{ {
using namespace std; using namespace std;
inline void string_format(string& res, const char* fmt, ...)
{
int size = 256;
va_list ap;
res.clear();
while (1) {
res.resize(size);
va_start(ap, fmt);
int n = vsnprintf((char *)res.c_str(), size, fmt, ap);
va_end(ap);
if (n > -1 && n < size) {
res.resize(n);
return;
}
if (n > -1)
size = n + 1;
else
size *= 2;
}
}
inline string string_format(const char* fmt, ...) inline string string_format(const char* fmt, ...)
{ {
int size = 256; int size = 256;