Fix build on win32

This commit is contained in:
Alexander Larsson 2009-05-20 15:59:11 +02:00
parent c897cca601
commit bb66fdcce3

View File

@ -26,6 +26,7 @@
*/ */
#include "config.h" #include "config.h"
#include "glib.h"
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
@ -1229,7 +1230,6 @@ g_socket_bind (GSocket *socket,
GError **error) GError **error)
{ {
struct sockaddr_storage addr; struct sockaddr_storage addr;
int value;
g_return_val_if_fail (G_IS_SOCKET (socket) && G_IS_SOCKET_ADDRESS (address), FALSE); g_return_val_if_fail (G_IS_SOCKET (socket) && G_IS_SOCKET_ADDRESS (address), FALSE);
@ -1239,11 +1239,15 @@ g_socket_bind (GSocket *socket,
/* SO_REUSEADDR on windows means something else and is not what we want. /* SO_REUSEADDR on windows means something else and is not what we want.
It always allows the unix variant of SO_REUSEADDR anyway */ It always allows the unix variant of SO_REUSEADDR anyway */
#ifndef G_OS_WIN32 #ifndef G_OS_WIN32
value = (int) !!reuse_address; {
/* Ignore errors here, the only likely error is "not supported", and int value;
this is a "best effort" thing mainly */
setsockopt (socket->priv->fd, SOL_SOCKET, SO_REUSEADDR, value = (int) !!reuse_address;
(gpointer) &value, sizeof (value)); /* Ignore errors here, the only likely error is "not supported", and
this is a "best effort" thing mainly */
setsockopt (socket->priv->fd, SOL_SOCKET, SO_REUSEADDR,
(gpointer) &value, sizeof (value));
}
#endif #endif
if (!g_socket_address_to_native (address, &addr, sizeof addr, error)) if (!g_socket_address_to_native (address, &addr, sizeof addr, error))
@ -1788,7 +1792,6 @@ g_socket_shutdown (GSocket *socket,
gboolean shutdown_write, gboolean shutdown_write,
GError **error) GError **error)
{ {
int res;
int how; int how;
g_return_val_if_fail (G_IS_SOCKET (socket), TRUE); g_return_val_if_fail (G_IS_SOCKET (socket), TRUE);
@ -2632,6 +2635,7 @@ g_socket_send_message (GSocket *socket,
} }
/* name */ /* name */
addrlen = 0; /* Avoid warning */
if (address) if (address)
{ {
addrlen = g_socket_address_get_native_size (address); addrlen = g_socket_address_get_native_size (address);