Skip to content

Commit dbe57d9

Browse files
committed
[NET] Removed Winsock deprecated define
1 parent bf89686 commit dbe57d9

File tree

6 files changed

+12
-23
lines changed

6 files changed

+12
-23
lines changed

src/xenia/kernel/util/net_utils.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ DECLARE_bool(logging);
2020
// TODO(Adrian): This should be moved to XConfig once supported.
2121
DEFINE_string(mac_address, "", "Console MAC address. (Do not touch!)", "Live");
2222

23+
#ifdef XE_PLATFORM_WIN32
24+
#include <WS2tcpip.h>
25+
#endif
26+
2327
namespace xe {
2428
namespace kernel {
2529

src/xenia/kernel/util/net_utils.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,7 @@
1717
#include "xenia/base/platform.h"
1818

1919
#ifdef XE_PLATFORM_WIN32
20-
// clang-format off
21-
// NOTE: must be included last as it expects windows.h to already be included.
22-
#define _WINSOCK_DEPRECATED_NO_WARNINGS // inet_addr
23-
#include <WS2tcpip.h> // NOLINT(build/include_order)
24-
#include <winsock2.h> // NOLINT(build/include_order)
25-
26-
#include <Iphlpapi.h>
27-
// clang-format on
20+
#include <ws2tcpip.h>
2821
#elif XE_PLATFORM_LINUX
2922
#include <arpa/inet.h>
3023
#endif

src/xenia/kernel/util/network_adapter_manager.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@
1818
#include "xenia/kernel/util/net_utils.h"
1919

2020
#ifdef XE_PLATFORM_WIN32
21-
// clang-format off
22-
// NOTE: must be included last as it expects windows.h to already be included.
23-
#define _WINSOCK_DEPRECATED_NO_WARNINGS // inet_addr
24-
#include <WS2tcpip.h> // NOLINT(build/include_order)
25-
#include <winsock2.h> // NOLINT(build/include_order)
26-
2721
#include <Iphlpapi.h>
28-
// clang-format on
2922
#endif
3023

3124
namespace xe {

src/xenia/kernel/xam/xam_net.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@
2626
#include "xenia/xbox.h"
2727

2828
#ifdef XE_PLATFORM_WIN32
29-
// NOTE: must be included last as it expects windows.h to already be included.
30-
#define _WINSOCK_DEPRECATED_NO_WARNINGS // inet_addr
31-
#include <WS2tcpip.h> // NOLINT(build/include_order)
32-
#include <comutil.h>
33-
#include <wrl/client.h>
29+
#include <WS2tcpip.h>
3430
#elif XE_PLATFORM_LINUX
3531
#include <arpa/inet.h>
3632
#include <netinet/in.h>
@@ -1872,11 +1868,16 @@ dword_result_t NetDll_inet_addr_entry(lpstring_t addr_ptr) {
18721868
return -1;
18731869
}
18741870

1871+
#pragma warning(push)
1872+
#pragma warning( \
1873+
disable : 4996, \
1874+
justification : "Retain original functionality e.g. Input Notation")
18751875
uint32_t addr = inet_addr(addr_ptr);
1876+
#pragma warning(pop)
18761877
// https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-inet_addr#return-value
18771878
// Based on console research it seems like x360 uses old version of
18781879
// inet_addr In case of empty string it return 0 instead of -1
1879-
if (addr == -1 && !addr_ptr.value().length()) {
1880+
if (addr == -1 && addr_ptr.value().empty()) {
18801881
return 0;
18811882
}
18821883

src/xenia/kernel/xnet.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "xenia/kernel/xam/user_property.h"
1919

2020
#ifdef XE_PLATFORM_WIN32
21-
#define _WINSOCK_DEPRECATED_NO_WARNINGS // inet_addr
2221
// clang-format off
2322
#include "xenia/base/platform_win.h"
2423
// clang-format on

src/xenia/kernel/xsocket.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#ifdef XE_PLATFORM_WIN32
2121
// clang-format off
22-
#define _WINSOCK_DEPRECATED_NO_WARNINGS // inet_addr
2322
#include "xenia/base/platform_win.h"
2423
#include <WS2tcpip.h>
2524
#include <WinSock2.h>

0 commit comments

Comments
 (0)