network: use Common::BitCast instead of std::bit_cast

This commit is contained in:
Sönke Holz 2021-08-13 01:28:14 +02:00
parent 8513e59431
commit a0c4c1a23a

View File

@ -4,6 +4,7 @@
#include <vector> #include <vector>
#include "common/bit_cast.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/string_util.h" #include "common/string_util.h"
@ -55,7 +56,7 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
continue; continue;
} }
const auto ip_addr = std::bit_cast<struct sockaddr_in>( const auto ip_addr = Common::BitCast<struct sockaddr_in>(
*current_address->FirstUnicastAddress->Address.lpSockaddr) *current_address->FirstUnicastAddress->Address.lpSockaddr)
.sin_addr; .sin_addr;
@ -99,7 +100,7 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
result.push_back(NetworkInterface{ result.push_back(NetworkInterface{
.name{ifa->ifa_name}, .name{ifa->ifa_name},
.ip_address{std::bit_cast<struct sockaddr_in>(*ifa->ifa_addr).sin_addr}}); .ip_address{Common::BitCast<struct sockaddr_in>(*ifa->ifa_addr).sin_addr}});
} }
freeifaddrs(ifaddr); freeifaddrs(ifaddr);