From c048a21aa409faa3dbaa0f5649b12806eff49abc Mon Sep 17 00:00:00 2001 From: pstef <3462925+pstef@users.noreply.github.com> Date: Thu, 10 Apr 2025 18:18:32 +0000 Subject: [PATCH] Use platform-specific checks for invalid descriptors Check network fd/socket validity using INVALID_SOCKET on Windows (requiring conditional winsock2.h include) and < 0 otherwise. Fixes -Wsign-compare warning. --- input/input_driver.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/input/input_driver.c b/input/input_driver.c index 6c6623a056..f663ae9fe4 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -62,6 +62,9 @@ #include "../verbosity.h" #include "../ai/game_ai.h" +#if defined(_WIN32) +#include +#endif #define HOLD_BTN_DELAY_SEC 2 @@ -6776,7 +6779,12 @@ void input_driver_poll(void) ssize_t ret; struct remote_message msg; + +#if defined(_WIN32) + if (input_st->remote->net_fd[user] == INVALID_SOCKET) +#else if (input_st->remote->net_fd[user] < 0) +#endif return; FD_ZERO(&fds);