I was doing janitorial Win64 printf format work on ws2_32 and noticed the following warning:
ws2_32/socket16.c:319: warning: passing arg 3 of `WS_ioctlsocket' from incompatible pointer type
which belongs to this piece of code: INT16 WINAPI ioctlsocket16(SOCKET16 s, LONG cmd, ULONG *argp) { return WS_ioctlsocket( s, cmd, argp ); /* <- line 319 */ }
It looks like WS_ioctlsocket's third argument is defined to point to a u_long (http://source.winehq.org/source/dlls/ws2_32/socket.c#L2276) which belongs to BSD (http://source.winehq.org/source/include/winsock.h#L118 for example).
Is it wrong "BSD-only" u_long in this function? Should WS_ioctlsocket be fixed to use a ULONG pointer?
On Thursday 12 October 2006 03:58, Michael [Plouj] Ploujnikov wrote:
INT16 WINAPI ioctlsocket16(SOCKET16 s, LONG cmd, ULONG *argp) { return WS_ioctlsocket( s, cmd, argp ); /* <- line 319 */ }
Is it wrong "BSD-only" u_long in this function? Should WS_ioctlsocket be fixed to use a ULONG pointer?
No that would just move the problem, because WS_ioctlsocket is also the implementation for ioctlsocket, which takes a pointer to u_long. Maybe something like this will do?
INT16 WINAPI ioctlsocket16(SOCKET16 s, LONG cmd, ULONG *argp) { u_long arg = *argp; return WS_ioctlsocket( s, cmd, &arg ); }
-Hans
On Thu, Oct 12, 2006 at 10:06:39AM +0200, Hans Leidekker wrote:
On Thursday 12 October 2006 03:58, Michael [Plouj] Ploujnikov wrote:
INT16 WINAPI ioctlsocket16(SOCKET16 s, LONG cmd, ULONG *argp) { return WS_ioctlsocket( s, cmd, argp ); /* <- line 319 */ }
Is it wrong "BSD-only" u_long in this function? Should WS_ioctlsocket be fixed to use a ULONG pointer?
No that would just move the problem, because WS_ioctlsocket is also the implementation for ioctlsocket, which takes a pointer to u_long. Maybe something like this will do?
INT16 WINAPI ioctlsocket16(SOCKET16 s, LONG cmd, ULONG *argp) { u_long arg = *argp; return WS_ioctlsocket( s, cmd, &arg ); }
argp is for in- and output.
I would just suggest to cast the warning away.
Ciao, Marcus
Marcus Meissner marcus@jet.franken.de writes:
On Thu, Oct 12, 2006 at 10:06:39AM +0200, Hans Leidekker wrote:
INT16 WINAPI ioctlsocket16(SOCKET16 s, LONG cmd, ULONG *argp) { u_long arg = *argp; return WS_ioctlsocket( s, cmd, &arg ); }
argp is for in- and output.
I would just suggest to cast the warning away.
That won't work on 64-bit though. I'm afraid we'll have to make u_long an unsigned int too.