summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiraj Razick <siraj.razick@collabora.co.uk>2012-01-26 16:20:04 -0500
committerSiraj Razick <siraj.razick@collabora.co.uk>2012-01-26 17:32:47 -0500
commit8a4afe112d4a61ffe9fa0fd629dd92fdc90e68b7 (patch)
tree8622b14ed939cedfb83367c9a94e115cf5b7dfd8
parent97a5823f03850f70bbd1da12af1364adc925e494 (diff)
Fix warnings from wocky-connector-test.c under mingw32
In windows socket API setsockopt takes a const char * as the fourth parameter, while on Linux it takes a void * so we cast to const char * which will work under both the platforms. This patch also move flags veriable in client_connected to the unix part of the ifdef, to remove warnings which shows up with mingw32.
-rw-r--r--tests/wocky-connector-test.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/wocky-connector-test.c b/tests/wocky-connector-test.c
index 624a551..7476540 100644
--- a/tests/wocky-connector-test.c
+++ b/tests/wocky-connector-test.c
@@ -3137,16 +3137,17 @@ client_connected (GIOChannel *channel,
int csock = accept (ssock, (struct sockaddr *) &client, &clen);
GSocket *gsock = g_socket_new_from_fd (csock, NULL);
test_t *test = data;
ConnectorProblem *cproblem = &test->server_parameters.problem.conn;
#ifdef G_OS_WIN32
u_long mode = 0;
+#else
+ long flags;
#endif
GSocketConnection *gconn;
- long flags;
if (csock < 0)
{
perror ("accept() failed");
g_warning ("accept() failed on socket that should have been ready.");
return TRUE;
@@ -3196,13 +3197,13 @@ start_dummy_xmpp_server (test_t *test)
server.sin_family = AF_INET;
/* mingw doesn't support aton or pton so using more portable inet_addr */
server.sin_addr.s_addr = inet_addr ((const char * ) REACHABLE);
server.sin_port = htons (port);
ssock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
- setsockopt (ssock, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof (reuse));
+ setsockopt (ssock, SOL_SOCKET, SO_REUSEADDR, (const char *) &reuse, sizeof (reuse));
res = bind (ssock, (struct sockaddr *) &server, sizeof (server));
if (res != 0)
{
int code = errno;