Display and control your Android device
Detect Windows using _WIN32 in network util
Romain Vimonta47848f30496
diff --git a/app/src/util/net.c b/app/src/util/net.cindex b1aa7445..e5f84676 100644--- a/app/src/util/net.c+++ b/app/src/util/net.c@@ -3,11 +3,10 @@#include <assert.h>#include <errno.h>#include <stdio.h>-#include <SDL2/SDL_platform.h>#include "log.h"-#ifdef __WINDOWS__+#ifdef _WIN32# include <ws2tcpip.h>typedef int socklen_t;typedef SOCKET sc_raw_socket;@@ -29,7 +28,7 @@boolnet_init(void) {-#ifdef __WINDOWS__+#ifdef _WIN32WSADATA wsa;int res = WSAStartup(MAKEWORD(2, 2), &wsa) < 0;if (res < 0) {@@ -42,14 +41,14 @@ net_init(void) {voidnet_cleanup(void) {-#ifdef __WINDOWS__+#ifdef _WIN32WSACleanup();#endif}static inline sc_socketwrap(sc_raw_socket sock) {-#ifdef __WINDOWS__+#ifdef _WIN32if (sock == INVALID_SOCKET) {return SC_SOCKET_NONE;}@@ -72,7 +71,7 @@ wrap(sc_raw_socket sock) {static inline sc_raw_socketunwrap(sc_socket socket) {-#ifdef __WINDOWS__+#ifdef _WIN32if (socket == SC_SOCKET_NONE) {return INVALID_SOCKET;}@@ -248,7 +247,7 @@ net_interrupt(sc_socket socket) {sc_raw_socket raw_sock = unwrap(socket);-#ifdef __WINDOWS__+#ifdef _WIN32if (!atomic_flag_test_and_set(&socket->closed)) {return !closesocket(raw_sock);}@@ -262,7 +261,7 @@ boolnet_close(sc_socket socket) {sc_raw_socket raw_sock = unwrap(socket);-#ifdef __WINDOWS__+#ifdef _WIN32bool ret = true;if (!atomic_flag_test_and_set(&socket->closed)) {ret = !closesocket(raw_sock);diff --git a/app/src/util/net.h b/app/src/util/net.hindex d9289981..801bdeaf 100644--- a/app/src/util/net.h+++ b/app/src/util/net.h@@ -5,9 +5,8 @@#include <stdbool.h>#include <stdint.h>-#include <SDL2/SDL_platform.h>-#ifdef __WINDOWS__+#ifdef _WIN32# include <winsock2.h># include <stdatomic.h>@@ -17,7 +16,7 @@atomic_flag closed;} *sc_socket;-#else // not __WINDOWS__+#else // not _WIN32# include <sys/socket.h># define SC_SOCKET_NONE -1