intel / dleyna-server

dleyna-server is a library for implementing services that allow clients to discover, browse and manipulate Digital Media Servers. An implementation of such a service for linux is also included.
https://01.org/dleyna/
GNU Lesser General Public License v2.1
28 stars 28 forks source link

Fix ChildCount property type #145

Closed hadess closed 9 years ago

hadess commented 10 years ago
From c5690d1786f74e9479a2daebfaac8a08d5ed617e Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Thu, 17 Jul 2014 17:52:13 +0200
Subject: [PATCH] [Device] Fix ChildCount property type

It's a uint32, not a signed int.

---
 libdleyna/server/props.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libdleyna/server/props.c b/libdleyna/server/props.c
index fc26ec2..13e76b5 100644
--- a/libdleyna/server/props.c
+++ b/libdleyna/server/props.c
@@ -622,7 +622,7 @@ static void prv_add_variant_prop(GVariantBuilder *vb, const gchar *key,

 void dls_props_add_child_count(GVariantBuilder *item_vb, gint value)
 {
-       prv_add_int_prop(item_vb, DLS_INTERFACE_PROP_CHILD_COUNT, value);
+       prv_add_uint_prop(item_vb, DLS_INTERFACE_PROP_CHILD_COUNT, value);
 }

 static void prv_add_bool_prop(GVariantBuilder *vb, const gchar *key,
-- 
2.0.1
hadess commented 9 years ago

We had to revert this patch in grilo, thinking that dleyna-server would get fixed quickly enough...

commit 555e1f1a83cc986c83184b811440150371eced4f
Author: Bastien Nocera <hadess@hadess.net>
Date:   Wed Jul 16 15:23:31 2014 +0200

    dleyna: ChildCount is an int32, not a uint32

    As verified inspecting the dleyna-server source code.

    https://bugzilla.gnome.org/show_bug.cgi?id=733253

diff --git a/src/dleyna/grl-dleyna-source.c b/src/dleyna/grl-dleyna-source.c
index 10c35c9..1129678 100644
--- a/src/dleyna/grl-dleyna-source.c
+++ b/src/dleyna/grl-dleyna-source.c
@@ -524,7 +524,7 @@ media_set_property (GrlMedia *media,
     }
   }
   else if (g_strcmp0 (key, "ChildCount") == 0) {
-    guint32 count = g_variant_get_uint32 (value);
+    gint32 count = g_variant_get_int32 (value);
     if (GRL_IS_MEDIA_BOX (media)) {
       grl_media_box_set_childcount (GRL_MEDIA_BOX (media), count);
     }

It's been broken for nearly 6 months now.

hadess commented 9 years ago

Thanks!