Skip to content

Commit c048a21

Browse files
committed
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.
1 parent 6a302d0 commit c048a21

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

input/input_driver.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
#include "../verbosity.h"
6363

6464
#include "../ai/game_ai.h"
65+
#if defined(_WIN32)
66+
#include <winsock2.h>
67+
#endif
6568

6669
#define HOLD_BTN_DELAY_SEC 2
6770

@@ -6776,7 +6779,12 @@ void input_driver_poll(void)
67766779
ssize_t ret;
67776780
struct remote_message msg;
67786781

6782+
6783+
#if defined(_WIN32)
6784+
if (input_st->remote->net_fd[user] == INVALID_SOCKET)
6785+
#else
67796786
if (input_st->remote->net_fd[user] < 0)
6787+
#endif
67806788
return;
67816789

67826790
FD_ZERO(&fds);

0 commit comments

Comments
 (0)