On Wed, 29 Apr 2015, Henri Verbeet wrote: [...]
Arguably it shouldn't be using UINT32_MAX at all, since it isn't actually used with uint32_t. I guess it should be using e.g. unsigned int with UINT_MAX instead.
The timeout receives a 64 bit value so using an unsigned int would not work. But using UINT_MAX plus the native limits.h can work.
static inline INT64 get_rcvsnd_timeo( int fd, BOOL is_recv) ... timeout = get_rcvsnd_timeo(fd, optname == WS_SO_RCVTIMEO); *(int *)optval = timeout <= UINT32_MAX ? timeout : UINT32_MAX;