[gssdp/gssdp_1.0] win32: Fix compiler issues with recent mingw



commit c982b4eee674f78bd27ee6a4158e98f625f5eba8
Author: Jens Georg <mail jensge org>
Date:   Sat Oct 15 07:45:15 2016 +0200

    win32: Fix compiler issues with recent mingw
    
    Signed-off-by: Jens Georg <mail jensge org>

 libgssdp/gssdp-client.c |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)
---
diff --git a/libgssdp/gssdp-client.c b/libgssdp/gssdp-client.c
index 7355441..655a713 100644
--- a/libgssdp/gssdp-client.c
+++ b/libgssdp/gssdp-client.c
@@ -226,18 +226,20 @@ gssdp_client_initable_init (GInitable                   *initable,
                 return TRUE;
 
 #ifdef G_OS_WIN32
-        WSADATA wsaData = {0};
-        if (WSAStartup (MAKEWORD (2,2), &wsaData) != 0) {
-                gchar *message;
-
-                message = g_win32_error_message (WSAGetLastError ());
-                g_set_error_literal (error,
-                                     GSSDP_ERROR,
-                                     GSSDP_ERROR_FAILED,
-                                     message);
-                g_free (message);
-
-                return FALSE;
+        {
+            WSADATA wsaData = {0};
+            if (WSAStartup (MAKEWORD (2,2), &wsaData) != 0) {
+                    gchar *message;
+
+                    message = g_win32_error_message (WSAGetLastError ());
+                    g_set_error_literal (error,
+                                         GSSDP_ERROR,
+                                         GSSDP_ERROR_FAILED,
+                                         message);
+                    g_free (message);
+
+                    return FALSE;
+            }
         }
 #endif
 
@@ -1567,7 +1569,6 @@ get_host_ip (GSSDPNetworkDevice *device)
                 char ip[INET6_ADDRSTRLEN];
                 char prefix[INET6_ADDRSTRLEN];
                 const char *p, *q;
-                PIP_ADAPTER_ADDRESSES adapter;
                 PIP_ADAPTER_UNICAST_ADDRESS address;
                 PIP_ADAPTER_PREFIX address_prefix;
 
@@ -1595,11 +1596,12 @@ get_host_ip (GSSDPNetworkDevice *device)
                         }
 
                         if (p != NULL) {
+                                gint32 mask = 0;
+
                                 device->host_ip = g_strdup (p);
                                 /* This relies on the compiler doing an arithmetic
                                  * shift here!
                                  */
-                                gint32 mask = 0;
                                 if (address_prefix->PrefixLength > 0) {
                                         mask = (gint32) 0x80000000;
                                         mask >>= address_prefix->PrefixLength - 1;


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