From ed21c61f433a663533ce8e87d13c067b9248cf46 Mon Sep 17 00:00:00 2001 From: Carlo Bramini <30959007+carlo-bramini@users.noreply.github.com> Date: Sun, 12 Nov 2023 13:22:46 +0100 Subject: [PATCH] WIN32: the nfds parameter of select() is unused. Winsock provides an opaque SOCKET type for handling sockets and the nfds parameter of select() is ignored but kept for compatibity with BSD standard. Expecting to handle sockets by not assuming to be an int type, this could cause a complain from MSVC when compiling for 64bit for Windows because incompatible types, so it would be better to just ignore this and just leave nfds to zero. --- src/server.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/server.c b/src/server.c index 0699b4f..130f6d5 100644 --- a/src/server.c +++ b/src/server.c @@ -1331,9 +1331,10 @@ void *lo_server_recv_raw_stream(lo_server s, size_t * size, int *psock) FD_ZERO(&ps); for (i = (s->sockets_len - 1); i >= 0; --i) { FD_SET(s->sockets[i].fd, &ps); +#ifndef WIN32 if (s->sockets[i].fd > nfds) nfds = s->sockets[i].fd; - +#endif if ((data = lo_server_buffer_copy_for_dispatch(s, i, size))) { *psock = s->sockets[i].fd; return data; @@ -1524,9 +1525,10 @@ int lo_servers_wait(lo_server *s, int *status, int num_servers, int timeout) for (j = 0; j < num_servers; j++) { for (i = 0; i < s[j]->sockets_len; i++) { FD_SET(s[j]->sockets[i].fd, &ps); +#ifndef WIN32 if (s[j]->sockets[i].fd > nfds) nfds = s[j]->sockets[i].fd; - +#endif if (lo_server_buffer_contains_msg(s[j], i)) { status[j] = 1; } @@ -1693,9 +1695,10 @@ int lo_server_recv(lo_server s) FD_ZERO(&ps); for (i = 0; i < s->sockets_len; i++) { FD_SET(s->sockets[i].fd, &ps); +#ifndef WIN32 if (s->sockets[i].fd > nfds) nfds = s->sockets[i].fd; - +#endif if (s->protocol == LO_TCP && (data = lo_server_buffer_copy_for_dispatch(s, i, &size))) {