summaryrefslogtreecommitdiff
path: root/net/gupnp/patches/patch-ad
blob: 91efbc137db4da78ab96f5eeb812a8b64c18d801 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
$NetBSD: patch-ad,v 1.8 2015/01/25 07:43:13 wiz Exp $

Add support for BSD uuid library.
https://bugzilla.gnome.org/show_bug.cgi?id=743072

--- libgupnp/gupnp-service.c.orig	2015-01-04 11:58:24.000000000 +0000
+++ libgupnp/gupnp-service.c
@@ -46,8 +46,12 @@
 #ifdef G_OS_WIN32
 #include <rpc.h>
 #else
+#if defined(__NetBSD__) || defined(__DragonFly__) || defined(__FreeBSD__)
+#include <uuid.h>
+#else
 #include <uuid/uuid.h>
 #endif
+#endif
 
 #define SUBSCRIPTION_TIMEOUT 300 /* DLNA (7.2.22.1) enforced */
 
@@ -1110,9 +1114,27 @@ generate_sid (void)
 #else
         uuid_t id;
         char out[39];
-
+#if defined(__NetBSD__) || defined(__DragonFly__) || defined(__FreeBSD__)
+        {
+                char *myout = NULL;
+                uint32_t status;
+
+                uuid_create (&id, &status);
+                if (status != uuid_s_ok) {
+                        return NULL;
+                }
+                uuid_to_string (&id, &myout, &status);
+                if (status != uuid_s_ok) {
+                        free (myout);
+                        return NULL;
+                }
+                strncpy (out, myout, sizeof(out));
+                free (myout);
+        }
+#else
         uuid_generate (id);
         uuid_unparse (id, out);
+#endif
 
         return g_strdup_printf ("uuid:%s", out);
 #endif