fixed compiling error by vc2012

This commit is contained in:
郑树新 2020-07-26 16:28:16 +08:00
parent 4da1f56f0a
commit a6976962cd
6 changed files with 22 additions and 20 deletions

View File

@ -368,7 +368,7 @@ bool client_servlet::doAction(acl::HttpServletRequest& req,
return false;
// 输出 XML 结尾标记
if (res.write("</servers>") == false)
if (res.write((acl::string)"</servers>") == false)
{
logger_error("write html end failed");
return false;

View File

@ -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);

View File

@ -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;

View File

@ -195,7 +195,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\include;..\..\..\lib_acl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -235,8 +235,8 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugDll|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ACL_CPP_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\include;..\..\..\lib_acl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ACL_DLL;ACL_CPP_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -251,7 +251,7 @@
<ProgramDatabaseFile>$(OutDir)md5.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalDependencies>lib_acl_cpp_d.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>lib_acl_d.lib;lib_acl_cpp_d.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>
@ -284,7 +284,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseDll|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\include;..\..\..\lib_acl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;ACL_CPP_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
@ -299,7 +299,7 @@
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalDependencies>lib_acl_cpp.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>lib_acl.lib;lib_acl_cpp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>

View File

@ -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

View File

@ -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);