[rygel] server: Only serialize child count if it's > 0



commit 99761575537776bd559be168acf74e7f3b77cae0
Author: Jens Georg <mail jensge org>
Date:   Sat May 23 18:35:54 2015 +0200

    server: Only serialize child count if it's > 0
    
    Signed-off-by: Jens Georg <mail jensge org>

 src/librygel-server/rygel-browse.vala          |    2 +-
 src/librygel-server/rygel-media-container.vala |    4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/librygel-server/rygel-browse.vala b/src/librygel-server/rygel-browse.vala
index a3cadfa..d0fd2a7 100644
--- a/src/librygel-server/rygel-browse.vala
+++ b/src/librygel-server/rygel-browse.vala
@@ -95,7 +95,7 @@ internal class Rygel.Browse: Rygel.MediaQueryAction {
         }
 
         var container = (MediaContainer) media_object;
-        if (container.child_count < int.MAX) {
+        if (-1 < container.child_count && container.child_count < int.MAX) {
             this.total_matches = container.child_count;
         } else {
             this.total_matches = 0;
diff --git a/src/librygel-server/rygel-media-container.vala b/src/librygel-server/rygel-media-container.vala
index 411cc8f..dd0c768 100644
--- a/src/librygel-server/rygel-media-container.vala
+++ b/src/librygel-server/rygel-media-container.vala
@@ -414,7 +414,9 @@ public abstract class Rygel.MediaContainer : MediaObject {
 
         didl_container.id = this.id;
         didl_container.title = this.title;
-        didl_container.child_count = this.child_count;
+        if (this.child_count > -1) {
+            didl_container.child_count = this.child_count;
+        }
         didl_container.upnp_class = this.upnp_class;
         didl_container.searchable = this is SearchableContainer;
         if (this.upnp_class == STORAGE_FOLDER) {


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