Bruno Haible <[EMAIL PROTECTED]> writes: > Simon Josefsson wrote: >> The sys_socket module generates this warning: >> >> ../lgl/sys/socket.h: In function 'rpl_fd_isset': >> ../lgl/sys/socket.h:158: warning: comparison between signed and unsigned >> ../lgl/sys/socket.h:159: warning: comparison between signed and unsigned >> >> I pushed the patch below. >> >> However, is the code really appropriate? I'm thinking of this comment: >> >> /* Re-define FD_ISSET to avoid a WSA call while we are not using >> network sockets. */ > > This comments means IMO that when someone is using select() on pipes and > console handles, he should not make ws2_32 calls.
Ah, I see. >> static inline int >> -rpl_fd_isset (int fd, fd_set * set) >> +rpl_fd_isset (SOCKET fd, fd_set * set) >> { >> - int i; >> + u_int i; >> if (set == NULL) >> return 0; > > I agree with the signature change, because this FD_ISSET replacement is > called by winsock-select.c. For the type of 'i', better use a portable type, > such as 'unsigned int'. 'u_int' is not a portable type - it may be present in > mingw and absent in MSVC's headers, who knows. Proposed patch below. Actually, u_int is the official Windows API type for the struct member, see: http://msdn.microsoft.com/en-us/library/ms737873.aspx I can't seem to find documentation for u_int, so I'm not sure if it is guaranteed to be the same as 'unsigned int'. /Simon > Bruno > > > --- lib/sys_socket.in.h.orig 2008-10-23 03:08:52.000000000 +0200 > +++ lib/sys_socket.in.h 2008-10-23 03:08:42.000000000 +0200 > @@ -122,7 +122,8 @@ > static inline int > rpl_fd_isset (SOCKET fd, fd_set * set) > { > - u_int i; > + unsigned int i; > + > if (set == NULL) > return 0; >