[glib] gio/tests/socket-client, socket-server: fix for win32



commit 5b329c506a8de5d21c3cd251be05a8d6b1f7fdba
Author: Dan Winship <danw gnome org>
Date:   Fri Apr 23 12:21:38 2010 -0400

    gio/tests/socket-client, socket-server: fix for win32
    
    The addition of unix socket support broke these on win32

 gio/tests/socket-client.c |    2 ++
 gio/tests/socket-common.c |    6 +++++-
 gio/tests/socket-server.c |    2 ++
 3 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gio/tests/socket-client.c b/gio/tests/socket-client.c
index 7b14de8..6e1881a 100644
--- a/gio/tests/socket-client.c
+++ b/gio/tests/socket-client.c
@@ -27,8 +27,10 @@ static GOptionEntry cmd_entries[] = {
    "Enable non-blocking i/o", NULL},
   {"use-source", 's', 0, G_OPTION_ARG_NONE, &use_source,
    "Use GSource to wait for non-blocking i/o", NULL},
+#ifdef G_OS_UNIX
   {"unix", 'U', 0, G_OPTION_ARG_NONE, &unix_socket,
    "Use a unix socket instead of IP", NULL},
+#endif
   {NULL}
 };
 
diff --git a/gio/tests/socket-common.c b/gio/tests/socket-common.c
index e06d504..8d2933b 100644
--- a/gio/tests/socket-common.c
+++ b/gio/tests/socket-common.c
@@ -11,7 +11,7 @@ static const char *unix_socket_address_types[] = {
 static char *
 socket_address_to_string (GSocketAddress *address)
 {
-  char *res;
+  char *res = NULL;
 
   if (G_IS_INET_SOCKET_ADDRESS (address))
     {
@@ -25,6 +25,7 @@ socket_address_to_string (GSocketAddress *address)
       res = g_strdup_printf ("%s:%d", str, port);
       g_free (str);
     }
+#ifdef G_OS_UNIX
   else if (G_IS_UNIX_SOCKET_ADDRESS (address))
     {
       GUnixSocketAddress *uaddr = G_UNIX_SOCKET_ADDRESS (address);
@@ -33,6 +34,7 @@ socket_address_to_string (GSocketAddress *address)
 			     unix_socket_address_types[g_unix_socket_address_get_address_type (uaddr)],
 			     g_unix_socket_address_get_path (uaddr));
     }
+#endif
 
   return res;
 }
@@ -40,6 +42,7 @@ socket_address_to_string (GSocketAddress *address)
 GSocketAddress *
 socket_address_from_string (const char *name)
 {
+#ifdef G_OS_UNIX
   int i, len;
 
   for (i = 0; i < G_N_ELEMENTS (unix_socket_address_types); i++)
@@ -52,5 +55,6 @@ socket_address_from_string (const char *name)
 						      (GUnixSocketAddressType)i);
 	}
     }
+#endif
   return NULL;
 }
diff --git a/gio/tests/socket-server.c b/gio/tests/socket-server.c
index 95be126..09ee48d 100644
--- a/gio/tests/socket-server.c
+++ b/gio/tests/socket-server.c
@@ -32,8 +32,10 @@ static GOptionEntry cmd_entries[] = {
    "Enable non-blocking i/o", NULL},
   {"use-source", 's', 0, G_OPTION_ARG_NONE, &use_source,
    "Use GSource to wait for non-blocking i/o", NULL},
+#ifdef G_OS_UNIX
   {"unix", 'U', 0, G_OPTION_ARG_NONE, &unix_socket,
    "Use a unix socket instead of IP", NULL},
+#endif
   {NULL}
 };
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]