Switched out C style cast to more favorable type
This commit is contained in:
parent
c447d5999d
commit
2bbaa917f8
|
@ -518,13 +518,13 @@ const char* getInterfaceName(const IPAddress& _ip) {
|
||||||
if(!iter->ifa_addr)
|
if(!iter->ifa_addr)
|
||||||
continue;
|
continue;
|
||||||
if (iter->ifa_addr->sa_family == AF_INET && _ip.isV4()) {
|
if (iter->ifa_addr->sa_family == AF_INET && _ip.isV4()) {
|
||||||
uint32_t ip = ntohl((((struct sockaddr_in*)iter->ifa_addr)->sin_addr.s_addr));
|
uint32_t ip = ntohl((reinterpret_cast<struct sockaddr_in*>(iter->ifa_addr))->sin_addr.s_addr);
|
||||||
if (ip == _ip.toV4()) {
|
if (ip == _ip.toV4()) {
|
||||||
ifa_name = iter->ifa_name;
|
ifa_name = iter->ifa_name;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (iter->ifa_addr->sa_family == AF_INET6 && _ip.isV6()) {
|
} else if (iter->ifa_addr->sa_family == AF_INET6 && _ip.isV6()) {
|
||||||
struct sockaddr_in6* ifa_addr = (struct sockaddr_in6*)iter->ifa_addr;
|
struct sockaddr_in6* ifa_addr = reinterpret_cast<struct sockaddr_in6*>(iter->ifa_addr);
|
||||||
if (memcmp(_ip.toV6().data(), &ifa_addr->sin6_addr, 16) == 0) {
|
if (memcmp(_ip.toV6().data(), &ifa_addr->sin6_addr, 16) == 0) {
|
||||||
ifa_name = iter->ifa_name;
|
ifa_name = iter->ifa_name;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue