Skip to content

Commit

Permalink
WIN32: the nfds parameter of select() is unused.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
carlo-bramini authored and JohannesLorenz committed Dec 3, 2023
1 parent cb078a0 commit ed21c61
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)))
{
Expand Down

0 comments on commit ed21c61

Please sign in to comment.