mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
win32: work around broken winsock prototypes
Re-#define a few socket functions to work around winsock's prototypes having, eg, "int *" rather than "unsigned int *", or "char *" rather than "void *". (Also fix two places that mistakenly assumed guint==guint32.) https://bugzilla.gnome.org/show_bug.cgi?id=688109
This commit is contained in:
parent
fc3acd88ba
commit
aa1418c427
@ -260,6 +260,20 @@ _win32_unset_event_mask (GSocket *socket, int mask)
|
||||
#define win32_unset_event_mask(_socket, _mask)
|
||||
#endif
|
||||
|
||||
/* Windows has broken prototypes... */
|
||||
#ifdef G_OS_WIN32
|
||||
#define getsockopt(sockfd, level, optname, optval, optlen) \
|
||||
getsockopt (sockfd, level, optname, (gpointer) optval, (int*) optlen)
|
||||
#define setsockopt(sockfd, level, optname, optval, optlen) \
|
||||
setsockopt (sockfd, level, optname, (gpointer) optval, optlen)
|
||||
#define getsockname(sockfd, addr, addrlen) \
|
||||
getsockname (sockfd, addr, (int *)addrlen)
|
||||
#define getpeername(sockfd, addr, addrlen) \
|
||||
getpeername (sockfd, addr, (int *)addrlen)
|
||||
#define recv(sockfd, buf, len, flags) \
|
||||
recv (sockfd, (gpointer)buf, len, flags)
|
||||
#endif
|
||||
|
||||
static void
|
||||
set_fd_nonblocking (int fd)
|
||||
{
|
||||
@ -1731,7 +1745,7 @@ g_socket_get_local_address (GSocket *socket,
|
||||
GError **error)
|
||||
{
|
||||
struct sockaddr_storage buffer;
|
||||
guint32 len = sizeof (buffer);
|
||||
guint len = sizeof (buffer);
|
||||
|
||||
g_return_val_if_fail (G_IS_SOCKET (socket), NULL);
|
||||
|
||||
@ -1764,7 +1778,7 @@ g_socket_get_remote_address (GSocket *socket,
|
||||
GError **error)
|
||||
{
|
||||
struct sockaddr_storage buffer;
|
||||
guint32 len = sizeof (buffer);
|
||||
guint len = sizeof (buffer);
|
||||
|
||||
g_return_val_if_fail (G_IS_SOCKET (socket), NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user