[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: setsockopt on mingw
From: |
Simon Josefsson |
Subject: |
Re: setsockopt on mingw |
Date: |
Wed, 23 Apr 2008 08:10:18 +0200 |
User-agent: |
Gnus/5.110009 (No Gnus v0.9) Emacs/22.2 (gnu/linux) |
Ben Pfaff <address@hidden> writes:
> Simon Josefsson <address@hidden> writes:
>
>> The follow patch appear to silent compiler warnings. Can anyone think
>> of a better way to fix this? If not I'll commit and push this shortly.
> [...]
>> +# if defined _WIN32 || defined __WIN32__
>> +# define setsockopt(a,b,c,d,e) setsockopt(a,b,c,(const void*)(d),e)
>> +# endif
>
> I do not know whether it is better, but the following is more
> type-safe:
>
> # if defined _WIN32 || defined __WIN32__
> # define setsockopt(a,b,c,d,e) rpl_setsockopt(a,b,c,d,e)
> static inline int
> rpl_setsockopt(int socket, int level, int optname, const void *optval,
> socklen_t optlen)
> {
> return (setsockopt)(socket, level, optname, optval, optlen);
> }
> # endif
Applied, thanks. (Windows setsockopt has a 'int' final parameter,
although socklen_t is int on Windows.)
/Simon