mirror of
https://github.com/yanyiwu/cppjieba.git
synced 2025-07-18 00:00:12 +08:00
update limonp
This commit is contained in:
parent
23aee266c3
commit
da1b9e0c1c
@ -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))
|
||||||
{
|
{
|
||||||
|
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user