summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiraj Razick <siraj.razick@collabora.co.uk>2012-02-13 21:02:44 (GMT)
committerOlli Salli <olli.salli@collabora.co.uk>2012-02-22 18:43:52 (GMT)
commitf0e85dcba7ce74f22abf22c5e64c372fdc268eda (patch)
tree5e818e714b8272749a678039285aceb74b5842fb
parent83eb3db22091ddbbfd44eeed79290bcd71d4a310 (diff)
downloadtelepathy-salut-f0e85dcba7ce74f22abf22c5e64c372fdc268eda.tar.gz
telepathy-salut-f0e85dcba7ce74f22abf22c5e64c372fdc268eda.tar.xz
gibber: Make gibber cross compile with mingw32
The patch provides the changes required to make gibber compile under mingw32. - Index is replaced with strchr since index is deprecated and not included in mingw32 sdk - D_WIN32_WINNT=0x0501 is defined to make getnameinfo work - And other compile fixes
-rw-r--r--lib/gibber/Makefile.am5
-rw-r--r--lib/gibber/gibber-listener.c2
-rw-r--r--lib/gibber/gibber-multicast-transport.c14
-rw-r--r--lib/gibber/gibber-sockets-win32.h4
-rw-r--r--lib/gibber/gibber-util.c4
5 files changed, 17 insertions, 12 deletions
diff --git a/lib/gibber/Makefile.am b/lib/gibber/Makefile.am
index d036c72..d442531 100644
--- a/lib/gibber/Makefile.am
+++ b/lib/gibber/Makefile.am
@@ -93,6 +93,11 @@ AM_CFLAGS = $(ERROR_CFLAGS) $(GCOV_CFLAGS) @GLIB_CFLAGS@ @LIBXML2_CFLAGS@ @WOCKY
AM_LDFLAGS = $(GCOV_LIBS) @GLIB_LIBS@ @LIBXML2_LIBS@ @WOCKY_LIBS@ @LIBSOUP_LIBS@
+# Required for getnameinfo to work when cross compiling
+if OS_WINDOWS
+ AM_CFLAGS += -D_WIN32_WINNT=0x0501
+endif
+
# rules for making the glib enum objects
%-enumtypes.h: %.h Makefile.in
$(AM_V_GEN)glib-mkenums \
diff --git a/lib/gibber/gibber-listener.c b/lib/gibber/gibber-listener.c
index 40d4610..3ad8b34 100644
--- a/lib/gibber/gibber-listener.c
+++ b/lib/gibber/gibber-listener.c
@@ -259,7 +259,7 @@ add_listener (GibberListener *self, int family, int type, int protocol,
goto error;
}
- ret = setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof (int));
+ ret = setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, (char *)&yes, sizeof (int));
if (ret == -1)
{
gibber_socket_set_error (error, "setsockopt failed",
diff --git a/lib/gibber/gibber-multicast-transport.c b/lib/gibber/gibber-multicast-transport.c
index d593c44..5151f43 100644
--- a/lib/gibber/gibber-multicast-transport.c
+++ b/lib/gibber/gibber-multicast-transport.c
@@ -150,7 +150,7 @@ _channel_io_in (GIOChannel *source, GIOCondition condition, gpointer data)
int ret;
socklen_t len = sizeof (struct sockaddr_storage);
- ret = recvfrom (priv->fd, buf, BUFSIZE, 0, (struct sockaddr *)&from, &len);
+ ret = recvfrom (priv->fd, (char *)buf, BUFSIZE, 0, (struct sockaddr *)&from, &len);
if (ret < 0)
{
@@ -214,18 +214,18 @@ _open_multicast (GibberMulticastTransport *self, GError **error)
goto err;
}
- SETSOCKOPT (fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof (yes));
+ SETSOCKOPT (fd, SOL_SOCKET, SO_REUSEADDR, (char *)&yes, sizeof (yes));
#ifdef SO_REUSEPORT
SETSOCKOPT (fd, SOL_SOCKET, SO_REUSEPORT, &yes, sizeof (yes));
#endif
- SETSOCKOPT (fd, IPPROTO_IP, IP_MULTICAST_LOOP, &yes, sizeof (yes));
- SETSOCKOPT (fd, IPPROTO_IP, IP_MULTICAST_TTL, &one, sizeof (one));
+ SETSOCKOPT (fd, IPPROTO_IP, IP_MULTICAST_LOOP, (char *)&yes, sizeof (yes));
+ SETSOCKOPT (fd, IPPROTO_IP, IP_MULTICAST_TTL, (char *)&one, sizeof (one));
mreq.imr_multiaddr =
((struct sockaddr_in *) &(priv->address))->sin_addr;
mreq.imr_interface.s_addr = htonl (INADDR_ANY);
- SETSOCKOPT (fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof (mreq));
+ SETSOCKOPT (fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&mreq, sizeof (mreq));
memset (&baddr, 0, sizeof (baddr));
baddr.sin_family = AF_INET;
@@ -259,7 +259,7 @@ _open_multicast (GibberMulticastTransport *self, GError **error)
((struct sockaddr_in6 *)&priv->address)->sin6_addr;
mreq6.ipv6mr_interface = 0;
- SETSOCKOPT (fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, &mreq6,
+ SETSOCKOPT (fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, (char *)&mreq6,
sizeof (mreq6));
if (bind (fd, (struct sockaddr *)&(priv->address), priv->addrlen)
@@ -466,7 +466,7 @@ gibber_multicast_transport_send (GibberTransport *transport,
return FALSE;
}
- if (sendto (priv->fd, data, size, 0,
+ if (sendto (priv->fd, (const char *)data, size, 0,
(struct sockaddr *)&(priv->address),
sizeof (struct sockaddr_storage)) < 0)
{
diff --git a/lib/gibber/gibber-sockets-win32.h b/lib/gibber/gibber-sockets-win32.h
index d35e3cb..e61e284 100644
--- a/lib/gibber/gibber-sockets-win32.h
+++ b/lib/gibber/gibber-sockets-win32.h
@@ -22,8 +22,8 @@
#include <winsock2.h>
#include <ws2tcpip.h>
-#include <Windows.h>
-#include <Winbase.h>
+#include <windows.h>
+#include <winbase.h>
/* Winsock makes some inappropriately-namespaced definitions */
#undef ERROR
#undef interface
diff --git a/lib/gibber/gibber-util.c b/lib/gibber/gibber-util.c
index b1cf93a..ff49ed1 100644
--- a/lib/gibber/gibber-util.c
+++ b/lib/gibber/gibber-util.c
@@ -38,8 +38,8 @@ gibber_normalize_address (struct sockaddr_storage *addr)
if (s6->sin6_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED (&(s6->sin6_addr)))
{
/* Normalize to ipv4 address */
- u_int32_t addr_big_endian;
- u_int16_t port;
+ guint32 addr_big_endian;
+ guint16 port;
memcpy (&addr_big_endian, s6->sin6_addr.s6_addr + 12, 4);
port = s6->sin6_port;