summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorspholz <44805808+spholz@users.noreply.github.com>2021-08-13 11:58:34 +0200
committerspholz <44805808+spholz@users.noreply.github.com>2021-08-13 11:58:34 +0200
commitdeb65a5717036c4f6497d4102082921352dfcda0 (patch)
tree52fb2bf2d6eec1b7132356f5e9df49df46659f3a /src/core
parentnetwork: fix mingw-w64 build (diff)
downloadyuzu-deb65a5717036c4f6497d4102082921352dfcda0.tar
yuzu-deb65a5717036c4f6497d4102082921352dfcda0.tar.gz
yuzu-deb65a5717036c4f6497d4102082921352dfcda0.tar.bz2
yuzu-deb65a5717036c4f6497d4102082921352dfcda0.tar.lz
yuzu-deb65a5717036c4f6497d4102082921352dfcda0.tar.xz
yuzu-deb65a5717036c4f6497d4102082921352dfcda0.tar.zst
yuzu-deb65a5717036c4f6497d4102082921352dfcda0.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/network/network_interface.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/core/network/network_interface.cpp b/src/core/network/network_interface.cpp
index e9060f13f..75f4dc54f 100644
--- a/src/core/network/network_interface.cpp
+++ b/src/core/network/network_interface.cpp
@@ -23,20 +23,17 @@ namespace Network {
#ifdef _WIN32
std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
- std::vector<u8> adapter_addresses_raw;
- auto adapter_addresses = reinterpret_cast<PIP_ADAPTER_ADDRESSES>(adapter_addresses_raw.data());
+ std::vector<IP_ADAPTER_ADDRESSES> adapter_addresses;
DWORD ret = ERROR_BUFFER_OVERFLOW;
DWORD buf_size = 0;
// retry up to 5 times
for (int i = 0; i < 5 && ret == ERROR_BUFFER_OVERFLOW; i++) {
ret = GetAdaptersAddresses(AF_INET, GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER,
- nullptr, adapter_addresses, &buf_size);
+ nullptr, adapter_addresses.data(), &buf_size);
if (ret == ERROR_BUFFER_OVERFLOW) {
- adapter_addresses_raw.resize(buf_size);
- adapter_addresses =
- reinterpret_cast<PIP_ADAPTER_ADDRESSES>(adapter_addresses_raw.data());
+ adapter_addresses.resize((buf_size / sizeof(IP_ADAPTER_ADDRESSES)) + 1);
} else {
break;
}
@@ -45,7 +42,7 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() {
if (ret == NO_ERROR) {
std::vector<NetworkInterface> result;
- for (auto current_address = adapter_addresses; current_address != nullptr;
+ for (auto current_address = adapter_addresses.data(); current_address != nullptr;
current_address = current_address->Next) {
if (current_address->FirstUnicastAddress == nullptr ||
current_address->FirstUnicastAddress->Address.lpSockaddr == nullptr) {