提交 382b1d66 编写于 作者: Peacoor Zomboss's avatar Peacoor Zomboss

Use better code and use default c++ std for msvc

上级 9907426c
...@@ -12,7 +12,7 @@ Hook *sendto_hook; ...@@ -12,7 +12,7 @@ Hook *sendto_hook;
SockQueue sockqueue; SockQueue sockqueue;
// 枚举当前所有可用网卡的IPv4地址 // 枚举当前所有可用网卡的IPv4地址
std::vector<in_addr> enum_addr() const std::vector<in_addr> &enum_addr()
{ {
static std::vector<in_addr> list; static std::vector<in_addr> list;
hostent *phost = gethostbyname(""); // 获取本机网卡 hostent *phost = gethostbyname(""); // 获取本机网卡
...@@ -52,7 +52,7 @@ int WINAPI fake_sendto(SOCKET s, const char *buf, int len, int flags, const sock ...@@ -52,7 +52,7 @@ int WINAPI fake_sendto(SOCKET s, const char *buf, int len, int flags, const sock
result = sendto(s, buf, len, flags, to, tolen); result = sendto(s, buf, len, flags, to, tolen);
getsockname(s, (sockaddr *)&addr_self, &namelen); // 重新获取 getsockname(s, (sockaddr *)&addr_self, &namelen); // 重新获取
} }
std::vector<in_addr> list = enum_addr(); const std::vector<in_addr> &list = enum_addr();
// 向列表中的每一个地址转发广播 // 向列表中的每一个地址转发广播
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
addr_self.sin_addr = list[i]; // 把新的地址换上去,然后发送 addr_self.sin_addr = list[i]; // 把新的地址换上去,然后发送
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalModuleDependencies> <AdditionalModuleDependencies>
</AdditionalModuleDependencies> </AdditionalModuleDependencies>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>Default</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<AdditionalModuleDependencies> <AdditionalModuleDependencies>
</AdditionalModuleDependencies> </AdditionalModuleDependencies>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>Default</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
<ClCompile> <ClCompile>
<AdditionalModuleDependencies> <AdditionalModuleDependencies>
</AdditionalModuleDependencies> </AdditionalModuleDependencies>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>Default</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<EntryPointSymbol> <EntryPointSymbol>
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
<ClCompile> <ClCompile>
<AdditionalModuleDependencies> <AdditionalModuleDependencies>
</AdditionalModuleDependencies> </AdditionalModuleDependencies>
<LanguageStandard>stdcpp20</LanguageStandard> <LanguageStandard>Default</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<EntryPointSymbol> <EntryPointSymbol>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册