[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
setsockopt on mingw
From: |
Simon Josefsson |
Subject: |
setsockopt on mingw |
Date: |
Tue, 22 Apr 2008 10:20:18 +0200 |
User-agent: |
Gnus/5.110009 (No Gnus v0.9) Emacs/22.2 (gnu/linux) |
Hi.
Under MinGW, setsockopt has a 'const char*' 4th argument instead of
'const void*' as specified by POSIX, compare:
http://www.opengroup.org/onlinepubs/009695399/functions/setsockopt.html
with
http://msdn2.microsoft.com/en-us/library/ms740476.aspx
This was raised in this report against gnutls:
http://thread.gmane.org/gmane.network.gnutls.general/1145/focus=1195
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.
/Simon
2008-04-22 Simon Josefsson <address@hidden>
* lib/sys_socket.in.h: Define setsockopt macro to cast fourth
parameter to void* as per POSIX standard (MinGW uses char*).
diff --git a/lib/sys_socket.in.h b/lib/sys_socket.in.h
index d94f425..cb84220 100644
--- a/lib/sys_socket.in.h
+++ b/lib/sys_socket.in.h
@@ -102,6 +102,10 @@
# define ESHUTDOWN WSAESHUTDOWN
# endif
+# if defined _WIN32 || defined __WIN32__
+# define setsockopt(a,b,c,d,e) setsockopt(a,b,c,(const void*)(d),e)
+# endif
+
#endif /* HAVE_SYS_SOCKET_H */
#endif /* _GL_SYS_SOCKET_H */
- setsockopt on mingw,
Simon Josefsson <=