[glib] gsocket: make this compile on Windows again
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gsocket: make this compile on Windows again
- Date: Wed, 18 Jan 2012 00:47:19 +0000 (UTC)
commit 08036ce30318a666a4f9df22512d74805be0d498
Author: Dan Winship <danw gnome org>
Date: Tue Jan 17 19:46:34 2012 -0500
gsocket: make this compile on Windows again
https://bugzilla.gnome.org/show_bug.cgi?id=668071
configure.ac | 2 +-
gio/gsocket.c | 24 +++++++++++++-----------
gio/gsocket.h | 4 ++--
3 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 882a53b..57e74f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1067,7 +1067,7 @@ if $glib_failed ; then
AC_MSG_ERROR([Could not determine values for MSG_* constants])
fi
-AC_CHECK_FUNCS(getprotobyname_r endservent)
+AC_CHECK_FUNCS(getprotobyname_r endservent if_nametoindex)
AC_CHECK_HEADERS([netdb.h wspiapi.h arpa/nameser_compat.h])
if test $glib_native_win32 = no; then
diff --git a/gio/gsocket.c b/gio/gsocket.c
index bce38f5..c4a0609 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -1898,7 +1898,7 @@ static gboolean
g_socket_multicast_group_operation (GSocket *socket,
GInetAddress *group,
gboolean source_specific,
- const gchar *interface,
+ const gchar *iface,
gboolean join_group,
GError **error)
{
@@ -1925,8 +1925,8 @@ g_socket_multicast_group_operation (GSocket *socket,
memcpy (&mc_req.imr_multiaddr, native_addr, sizeof (struct in_addr));
#ifdef HAVE_IP_MREQN
- if (interface)
- mc_req.imr_ifindex = if_nametoindex (interface);
+ if (iface)
+ mc_req.imr_ifindex = if_nametoindex (iface);
else
mc_req.imr_ifindex = 0; /* Pick any. */
#else
@@ -1945,9 +1945,11 @@ g_socket_multicast_group_operation (GSocket *socket,
struct ipv6_mreq mc_req_ipv6;
memcpy (&mc_req_ipv6.ipv6mr_multiaddr, native_addr, sizeof (struct in6_addr));
- if (interface)
- mc_req_ipv6.ipv6mr_interface = if_nametoindex (interface);
+#ifdef HAVE_IF_NAMETOINDEX
+ if (iface)
+ mc_req_ipv6.ipv6mr_interface = if_nametoindex (iface);
else
+#endif
mc_req_ipv6.ipv6mr_interface = 0;
optname = join_group ? IPV6_JOIN_GROUP : IPV6_LEAVE_GROUP;
@@ -1976,7 +1978,7 @@ g_socket_multicast_group_operation (GSocket *socket,
* g_socket_join_multicast_group:
* @socket: a #GSocket.
* @group: a #GInetAddress specifying the group address to join.
- * @interface: Interface to use
+ * @iface: Interface to use
* @source_specific: %TRUE if source-specific multicast should be used
* @error: #GError for error reporting, or %NULL to ignore.
*
@@ -1996,17 +1998,17 @@ gboolean
g_socket_join_multicast_group (GSocket *socket,
GInetAddress *group,
gboolean source_specific,
- const gchar *interface,
+ const gchar *iface,
GError **error)
{
- return g_socket_multicast_group_operation (socket, group, source_specific, interface, TRUE, error);
+ return g_socket_multicast_group_operation (socket, group, source_specific, iface, TRUE, error);
}
/**
* g_socket_leave_multicast_group:
* @socket: a #GSocket.
* @group: a #GInetAddress specifying the group address to leave.
- * @interface: Interface to use
+ * @iface: Interface to use
* @source_specific: %TRUE if source-specific multicast should be used
* @error: #GError for error reporting, or %NULL to ignore.
*
@@ -2024,10 +2026,10 @@ gboolean
g_socket_leave_multicast_group (GSocket *socket,
GInetAddress *group,
gboolean source_specific,
- const gchar *interface,
+ const gchar *iface,
GError **error)
{
- return g_socket_multicast_group_operation (socket, group, source_specific, interface, FALSE, error);
+ return g_socket_multicast_group_operation (socket, group, source_specific, iface, FALSE, error);
}
/**
diff --git a/gio/gsocket.h b/gio/gsocket.h
index ae7673c..1ad6a6f 100644
--- a/gio/gsocket.h
+++ b/gio/gsocket.h
@@ -123,12 +123,12 @@ gboolean g_socket_bind (GSocket
gboolean g_socket_join_multicast_group (GSocket *socket,
GInetAddress *group,
gboolean source_specific,
- const gchar *interface,
+ const gchar *iface,
GError **error);
gboolean g_socket_leave_multicast_group (GSocket *socket,
GInetAddress *group,
gboolean source_specific,
- const gchar *interface,
+ const gchar *iface,
GError **error);
gboolean g_socket_connect (GSocket *socket,
GSocketAddress *address,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]