提交 1b467b58 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Resolve IP.cpp

上级 2c0d53c4
...@@ -13,7 +13,7 @@ namespace Utils ...@@ -13,7 +13,7 @@ namespace Utils
{ {
MS_TRACE(); MS_TRACE();
int ipFamily = 0; int ipFamily{ 0 };
/** /**
* Ragel: machine definition. * Ragel: machine definition.
...@@ -3993,13 +3993,13 @@ case 86: ...@@ -3993,13 +3993,13 @@ case 86:
#line 64 "src/Utils/IP.rl" #line 64 "src/Utils/IP.rl"
// Ensure that the parsing has consumed all the given length. // Ensure that the parsing has consumed all the given length.
if (ipLen == (size_t)(p - (const unsigned char*)ip)) if (ipLen == static_cast<size_t>(p - (const unsigned char*)ip))
return ipFamily; return ipFamily;
else else
return AF_UNSPEC; return AF_UNSPEC;
} }
void IP::GetAddressInfo(const struct sockaddr* addr, int* family, std::string &ip, uint16_t* port) void IP::GetAddressInfo(const struct sockaddr* addr, int* family, std::string& ip, uint16_t* port)
{ {
MS_TRACE(); MS_TRACE();
...@@ -4016,7 +4016,7 @@ case 86: ...@@ -4016,7 +4016,7 @@ case 86:
if (err) if (err)
MS_ABORT("uv_inet_ntop() failed: %s", uv_strerror(err)); MS_ABORT("uv_inet_ntop() failed: %s", uv_strerror(err));
*port = (uint16_t)ntohs(((struct sockaddr_in*)addr)->sin_port); *port = static_cast<uint16_t>(ntohs(((struct sockaddr_in*)addr)->sin_port));
break; break;
} }
...@@ -4029,7 +4029,7 @@ case 86: ...@@ -4029,7 +4029,7 @@ case 86:
if (err) if (err)
MS_ABORT("uv_inet_ntop() failed: %s", uv_strerror(err)); MS_ABORT("uv_inet_ntop() failed: %s", uv_strerror(err));
*port = (uint16_t)ntohs(((struct sockaddr_in6*)addr)->sin6_port); *port = static_cast<uint16_t>(ntohs(((struct sockaddr_in6*)addr)->sin6_port));
break; break;
} }
......
...@@ -11,7 +11,7 @@ namespace Utils ...@@ -11,7 +11,7 @@ namespace Utils
{ {
MS_TRACE(); MS_TRACE();
int ipFamily = 0; int ipFamily{ 0 };
/** /**
* Ragel: machine definition. * Ragel: machine definition.
...@@ -63,13 +63,13 @@ namespace Utils ...@@ -63,13 +63,13 @@ namespace Utils
%%write exec; %%write exec;
// Ensure that the parsing has consumed all the given length. // Ensure that the parsing has consumed all the given length.
if (ipLen == (size_t)(p - (const unsigned char*)ip)) if (ipLen == static_cast<size_t>(p - (const unsigned char*)ip))
return ipFamily; return ipFamily;
else else
return AF_UNSPEC; return AF_UNSPEC;
} }
void IP::GetAddressInfo(const struct sockaddr* addr, int* family, std::string &ip, uint16_t* port) void IP::GetAddressInfo(const struct sockaddr* addr, int* family, std::string& ip, uint16_t* port)
{ {
MS_TRACE(); MS_TRACE();
...@@ -86,7 +86,7 @@ namespace Utils ...@@ -86,7 +86,7 @@ namespace Utils
if (err) if (err)
MS_ABORT("uv_inet_ntop() failed: %s", uv_strerror(err)); MS_ABORT("uv_inet_ntop() failed: %s", uv_strerror(err));
*port = (uint16_t)ntohs(((struct sockaddr_in*)addr)->sin_port); *port = static_cast<uint16_t>(ntohs(((struct sockaddr_in*)addr)->sin_port));
break; break;
} }
...@@ -99,7 +99,7 @@ namespace Utils ...@@ -99,7 +99,7 @@ namespace Utils
if (err) if (err)
MS_ABORT("uv_inet_ntop() failed: %s", uv_strerror(err)); MS_ABORT("uv_inet_ntop() failed: %s", uv_strerror(err));
*port = (uint16_t)ntohs(((struct sockaddr_in6*)addr)->sin6_port); *port = static_cast<uint16_t>(ntohs(((struct sockaddr_in6*)addr)->sin6_port));
break; break;
} }
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论