diff options
| author | 2021-08-13 00:37:03 +0200 | |
|---|---|---|
| committer | 2021-08-13 00:37:03 +0200 | |
| commit | 8513e594310af03df7613fb3255b6ca5cd84710d (patch) | |
| tree | 083ff1ba9d82ab20a2a8ec6b28d04e77b82d1aa3 /src | |
| parent | configuration: use tr instead of QStringLiteral for "None" item in (diff) | |
| download | yuzu-8513e594310af03df7613fb3255b6ca5cd84710d.tar.gz yuzu-8513e594310af03df7613fb3255b6ca5cd84710d.tar.xz yuzu-8513e594310af03df7613fb3255b6ca5cd84710d.zip | |
network: narrow down scope of "result" in win32 code for
GetAvailableNetworkInterfaces
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/network/network_interface.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/network/network_interface.cpp b/src/core/network/network_interface.cpp index 887aee708..34e20f547 100644 --- a/src/core/network/network_interface.cpp +++ b/src/core/network/network_interface.cpp | |||
| @@ -22,8 +22,6 @@ namespace Network { | |||
| 22 | #ifdef _WIN32 | 22 | #ifdef _WIN32 |
| 23 | 23 | ||
| 24 | std::vector<NetworkInterface> GetAvailableNetworkInterfaces() { | 24 | std::vector<NetworkInterface> GetAvailableNetworkInterfaces() { |
| 25 | std::vector<NetworkInterface> result; | ||
| 26 | |||
| 27 | std::vector<u8> adapter_addresses_raw; | 25 | std::vector<u8> adapter_addresses_raw; |
| 28 | auto adapter_addresses = reinterpret_cast<PIP_ADAPTER_ADDRESSES>(adapter_addresses_raw.data()); | 26 | auto adapter_addresses = reinterpret_cast<PIP_ADAPTER_ADDRESSES>(adapter_addresses_raw.data()); |
| 29 | DWORD ret = ERROR_BUFFER_OVERFLOW; | 27 | DWORD ret = ERROR_BUFFER_OVERFLOW; |
| @@ -44,6 +42,8 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() { | |||
| 44 | } | 42 | } |
| 45 | 43 | ||
| 46 | if (ret == NO_ERROR) { | 44 | if (ret == NO_ERROR) { |
| 45 | std::vector<NetworkInterface> result; | ||
| 46 | |||
| 47 | for (auto current_address = adapter_addresses; current_address != nullptr; | 47 | for (auto current_address = adapter_addresses; current_address != nullptr; |
| 48 | current_address = current_address->Next) { | 48 | current_address = current_address->Next) { |
| 49 | if (current_address->FirstUnicastAddress == nullptr || | 49 | if (current_address->FirstUnicastAddress == nullptr || |
| @@ -63,11 +63,12 @@ std::vector<NetworkInterface> GetAvailableNetworkInterfaces() { | |||
| 63 | .name{Common::UTF16ToUTF8(std::wstring{current_address->FriendlyName})}, | 63 | .name{Common::UTF16ToUTF8(std::wstring{current_address->FriendlyName})}, |
| 64 | .ip_address{ip_addr}}); | 64 | .ip_address{ip_addr}}); |
| 65 | } | 65 | } |
| 66 | |||
| 67 | return result; | ||
| 66 | } else { | 68 | } else { |
| 67 | LOG_ERROR(Network, "Failed to get network interfaces with GetAdaptersAddresses"); | 69 | LOG_ERROR(Network, "Failed to get network interfaces with GetAdaptersAddresses"); |
| 70 | return {}; | ||
| 68 | } | 71 | } |
| 69 | |||
| 70 | return result; | ||
| 71 | } | 72 | } |
| 72 | 73 | ||
| 73 | #else | 74 | #else |