[gupnp-tools] network-light: Use UUID function from GUPnP



commit 899118659c76e692df1f90b981e5faac485c1eb6
Author: Jens Georg <mail jensge org>
Date:   Sun Jun 14 14:06:13 2015 +0200

    network-light: Use UUID function from GUPnP
    
    Signed-off-by: Jens Georg <mail jensge org>

 configure.ac             |    7 ++-----
 src/network-light/upnp.c |   25 ++++---------------------
 2 files changed, 6 insertions(+), 26 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4c87a8f..1fcfa9b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,7 +30,7 @@ LT_INIT([])
 
 GLIB_REQUIRED=2.24
 GSSDP_REQUIRED=0.13.3
-GUPNP_REQUIRED=0.20.8
+GUPNP_REQUIRED=0.20.14
 SOUP_REQUIRED=2.4
 GUPNP_AV_REQUIRED=0.5.5
 GTK_REQUIRED=3.10
@@ -64,11 +64,8 @@ PKG_CHECK_MODULES(GTKSOURCEVIEW, gtksourceview-3.0 >= $GTKSOURCEVIEW_REQUIRED,
                   AC_SUBST([TEXT_VIEW],[GtkSourceView]),
                   AC_SUBST([TEXT_VIEW],[GtkTextView]))
 
-if test "x$os_win32" = "xno"; then
-    PKG_CHECK_MODULES(UUID, uuid)
-else
+if test "x$os_win32" = "xyes"; then
     AC_CHECK_TOOL(WINDRES, windres)
-    AC_SUBST([UUID_LIBS], ["-lrpcrt4"])
 fi
 
 AC_ARG_WITH( av,
diff --git a/src/network-light/upnp.c b/src/network-light/upnp.c
index f1c93bf..ca55de6 100644
--- a/src/network-light/upnp.c
+++ b/src/network-light/upnp.c
@@ -26,12 +26,6 @@
 #include <locale.h>
 #include <string.h>
 #include <gmodule.h>
-#ifndef G_OS_WIN32
-#include <uuid/uuid.h>
-#else
-#include <rpc.h>
-typedef UUID uuid_t;
-#endif
 #include <glib/gstdio.h>
 
 #include "gui.h"
@@ -59,7 +53,7 @@ static GList *dimming_proxies;
 
 static GUPnPXMLDoc *doc;
 static char *desc_location;
-static char uuid[37];
+static char *uuid;
 
 void
 on_get_status (GUPnPService       *service,
@@ -386,23 +380,10 @@ xml_util_get_element (xmlNode *node,
 
 static void init_uuid (void)
 {
-        uuid_t uuid_context;
         xmlNode *uuid_node;
         char *udn;
 
-#ifndef G_OS_WIN32
-        uuid_generate (uuid_context);
-        uuid_unparse (uuid_context, uuid);
-#else
-       {
-               gchar *tmp_uuid;
-               UuidCreate(&uuid_context);
-               UuidToString(&uuid_context, &tmp_uuid);
-               memcpy(uuid, tmp_uuid, 36);
-               RpcStringFree(&tmp_uuid);
-       }
-#endif
-
+        uuid = gupnp_get_uuid ();
         uuid_node = xml_util_get_element ((xmlNode *) doc->doc,
                                           "root",
                                           "device",
@@ -778,5 +759,7 @@ deinit_upnp (void)
         if (g_remove (desc_location) != 0)
                 g_warning ("error removing %s\n", desc_location);
         g_free (desc_location);
+        g_free (uuid);
+        uuid = NULL;
 }
 


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