From a6976962cdccf82064f0a1809152bb9577a12045 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E6=A0=91=E6=96=B0?= Date: Sun, 26 Jul 2020 16:28:16 +0800 Subject: [PATCH] fixed compiling error by vc2012 --- .../manager/client_servlet.cpp | 2 +- .../disque/disque_cluster/disque_cluster.cpp | 4 ++-- .../samples/http_servlet2/http_servlet.cpp | 19 ++++++++++--------- lib_acl_cpp/samples/md5/md5_vc2012.vcxproj | 12 ++++++------ lib_acl_cpp/src/stream/stream.cpp | 2 +- lib_fiber/samples/client2/main.c | 3 ++- 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/app/master/tools/master_dispatch/manager/client_servlet.cpp b/app/master/tools/master_dispatch/manager/client_servlet.cpp index 0f7b5b621..82ebd6cca 100644 --- a/app/master/tools/master_dispatch/manager/client_servlet.cpp +++ b/app/master/tools/master_dispatch/manager/client_servlet.cpp @@ -368,7 +368,7 @@ bool client_servlet::doAction(acl::HttpServletRequest& req, return false; // 输出 XML 结尾标记 - if (res.write("") == false) + if (res.write((acl::string)"") == false) { logger_error("write html end failed"); return false; diff --git a/lib_acl_cpp/samples/disque/disque_cluster/disque_cluster.cpp b/lib_acl_cpp/samples/disque/disque_cluster/disque_cluster.cpp index 832ba2136..293d9657b 100644 --- a/lib_acl_cpp/samples/disque/disque_cluster/disque_cluster.cpp +++ b/lib_acl_cpp/samples/disque/disque_cluster/disque_cluster.cpp @@ -154,8 +154,8 @@ protected: { bool ret; acl::disque cmd; - int max_conns = 1000, i; - cmd.set_cluster(&cluster_, max_conns); + int i; + cmd.set_cluster(&cluster_); struct timeval begin; gettimeofday(&begin, NULL); diff --git a/lib_acl_cpp/samples/http_servlet2/http_servlet.cpp b/lib_acl_cpp/samples/http_servlet2/http_servlet.cpp index 63cfc4a98..16e854b84 100644 --- a/lib_acl_cpp/samples/http_servlet2/http_servlet.cpp +++ b/lib_acl_cpp/samples/http_servlet2/http_servlet.cpp @@ -47,8 +47,8 @@ bool http_servlet::doPost(acl::HttpServletRequest& req, .setChunkedTransferEncoding(true); // chunked 传输模式 // 发送 http 响应体 - - if (res.write("first line\r\nsecond line\r\nthird line\r\n\r\n") == false) + acl::string buf("first line\r\nsecond line\r\nthird line\r\n\r\n"); + if (res.write(buf) == false) { logger_error("write error!"); return false; @@ -56,22 +56,23 @@ bool http_servlet::doPost(acl::HttpServletRequest& req, for (int i = 0; i < 10; i++) { - if (res.write("hello") == false) + acl::string buf("hello"); + if (res.write(buf) == false) { logger_error("write error!"); return false; } - if (res.write(" ") == false) + if (res.write((acl::string)" ") == false) { logger_error("write error!"); return false; } - if (res.write("world") == false) + if (res.write((acl::string)"world") == false) { logger_error("write error!"); return false; } - if (res.write("\r\n") == false) + if (res.write((acl::string)"\r\n") == false) { logger_error("write error!"); return false; @@ -82,14 +83,14 @@ bool http_servlet::doPost(acl::HttpServletRequest& req, { for (int i = 0; i < 10; i++) { - if (res.write("X") == false) + if (res.write((acl::string)"X") == false) { logger_error("write error!"); return false; } } - if (res.write("\r\n") == false) + if (res.write((acl::string)"\r\n") == false) { logger_error("write error!"); return false; @@ -97,7 +98,7 @@ bool http_servlet::doPost(acl::HttpServletRequest& req, } // 最后一行不写 \r\n - if (res.write("Bye") == false) + if (res.write((acl::string)"Bye") == false) { logger_error("write error!"); return false; diff --git a/lib_acl_cpp/samples/md5/md5_vc2012.vcxproj b/lib_acl_cpp/samples/md5/md5_vc2012.vcxproj index a8e86660f..20f5e9627 100644 --- a/lib_acl_cpp/samples/md5/md5_vc2012.vcxproj +++ b/lib_acl_cpp/samples/md5/md5_vc2012.vcxproj @@ -195,7 +195,7 @@ - ..\..\include;%(AdditionalIncludeDirectories) + ..\..\include;..\..\..\lib_acl\include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreaded Use @@ -235,8 +235,8 @@ Disabled - ..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ACL_CPP_DLL;%(PreprocessorDefinitions) + ..\..\include;..\..\..\lib_acl\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ACL_DLL;ACL_CPP_DLL;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDebugDLL @@ -251,7 +251,7 @@ $(OutDir)md5.pdb Console MachineX86 - lib_acl_cpp_d.lib;%(AdditionalDependencies) + lib_acl_d.lib;lib_acl_cpp_d.lib;%(AdditionalDependencies) @@ -284,7 +284,7 @@ - ..\..\include;%(AdditionalIncludeDirectories) + ..\..\include;..\..\..\lib_acl\include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;ACL_CPP_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreadedDLL Use @@ -299,7 +299,7 @@ true true MachineX86 - lib_acl_cpp.lib;%(AdditionalDependencies) + lib_acl.lib;lib_acl_cpp.lib;%(AdditionalDependencies) diff --git a/lib_acl_cpp/src/stream/stream.cpp b/lib_acl_cpp/src/stream/stream.cpp index 0268d9543..1791eb1b3 100644 --- a/lib_acl_cpp/src/stream/stream.cpp +++ b/lib_acl_cpp/src/stream/stream.cpp @@ -2,7 +2,7 @@ #ifndef ACL_PREPARE_COMPILE #include "acl_cpp/stdlib/log.hpp" #include "acl_cpp/stdlib/string.hpp" -#include "acl_cpp/stdlib/dbuf.hpp" +#include "acl_cpp/stdlib/dbuf_pool.hpp" #include "acl_cpp/stream/stream_hook.hpp" #include "acl_cpp/stream/stream.hpp" #endif diff --git a/lib_fiber/samples/client2/main.c b/lib_fiber/samples/client2/main.c index b2cb1352d..b78accf77 100644 --- a/lib_fiber/samples/client2/main.c +++ b/lib_fiber/samples/client2/main.c @@ -170,7 +170,8 @@ static void test_time(void) double diff; gettimeofday(&begin, NULL); - usleep(1000); + //usleep(1000); + acl_doze(1); gettimeofday(&end, NULL); diff = stamp_sub(&end, &begin); printf("usleep 1000 diff=%.2f\r\n", diff);