Skip to content

Commit c632d24

Browse files
committed
platform: Use the real SDL3 Windows preprocessor check, not _WIN32.
1 parent 21dbfe3 commit c632d24

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/SDL_net.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
#include "SDL3_net/SDL_net.h"
3434

35-
#ifdef _WIN32
35+
#ifdef SDL_PLATFORM_WINDOWS
3636
#define WIN32_LEAN_AND_MEAN 1
3737
#include <winsock2.h>
3838
#include <ws2tcpip.h>
@@ -137,7 +137,7 @@ static bool ShouldSimulateLoss(const int percent_likely_to_lose)
137137

138138
static int CloseSocketHandle(Socket handle)
139139
{
140-
#ifdef _WIN32
140+
#ifdef SDL_PLATFORM_WINDOWS
141141
return closesocket(handle);
142142
#else
143143
return close(handle);
@@ -146,7 +146,7 @@ static int CloseSocketHandle(Socket handle)
146146

147147
static int LastSocketError(void)
148148
{
149-
#ifdef _WIN32
149+
#ifdef SDL_PLATFORM_WINDOWS
150150
return WSAGetLastError();
151151
#else
152152
return errno;
@@ -155,7 +155,7 @@ static int LastSocketError(void)
155155

156156
static char *CreateSocketErrorString(int rc)
157157
{
158-
#ifdef _WIN32
158+
#ifdef SDL_PLATFORM_WINDOWS
159159
WCHAR msgbuf[256];
160160
const DWORD bw = FormatMessageW(
161161
FORMAT_MESSAGE_FROM_SYSTEM |
@@ -178,7 +178,7 @@ static char *CreateSocketErrorString(int rc)
178178

179179
static char *CreateGetAddrInfoErrorString(int rc)
180180
{
181-
#ifdef _WIN32
181+
#ifdef SDL_PLATFORM_WINDOWS
182182
return CreateSocketErrorString(rc); // same error codes.
183183
#else
184184
return SDL_strdup((rc == EAI_SYSTEM) ? strerror(errno) : gai_strerror(rc));
@@ -391,7 +391,7 @@ bool NET_Init(void)
391391

392392
char *origerrstr = NULL;
393393

394-
#ifdef _WIN32
394+
#ifdef SDL_PLATFORM_WINDOWS
395395
WSADATA data;
396396
if (WSAStartup(MAKEWORD(1, 1), &data) != 0) {
397397
return SetSocketErrorBool("WSAStartup() failed", LastSocketError());
@@ -480,7 +480,7 @@ void NET_Quit(void)
480480

481481
resolver_queue = NULL;
482482

483-
#ifdef _WIN32
483+
#ifdef SDL_PLATFORM_WINDOWS
484484
WSACleanup();
485485
#endif
486486
}
@@ -650,7 +650,7 @@ NET_Address **NET_GetLocalAddresses(int *num_addresses)
650650

651651
*num_addresses = 0;
652652

653-
#ifdef _WIN32
653+
#ifdef SDL_PLATFORM_WINDOWS
654654
// !!! FIXME: maybe LoadLibrary(iphlpapi) on the first call, since most
655655
// !!! FIXME: things won't ever use this.
656656

@@ -812,7 +812,7 @@ struct NET_StreamSocket
812812

813813
static int MakeSocketNonblocking(Socket handle)
814814
{
815-
#ifdef _WIN32
815+
#ifdef SDL_PLATFORM_WINDOWS
816816
DWORD one = 1;
817817
return ioctlsocket(handle, FIONBIO, &one);
818818
#else
@@ -822,7 +822,7 @@ static int MakeSocketNonblocking(Socket handle)
822822

823823
static bool WouldBlock(const int err)
824824
{
825-
#ifdef _WIN32
825+
#ifdef SDL_PLATFORM_WINDOWS
826826
return (err == WSAEWOULDBLOCK) ? true : false;
827827
#else
828828
return ((err == EWOULDBLOCK) || (err == EAGAIN) || (err == EINPROGRESS)) ? true : false;

0 commit comments

Comments
 (0)