core: INT_MAX children means "Don't know"
authorJens Georg <mail@jensge.org>
Sat, 25 Feb 2012 15:26:02 +0000 (17:26 +0200)
committerJens Georg <mail@jensge.org>
Tue, 17 Jul 2012 06:47:07 +0000 (08:47 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=661988

src/librygel-core/rygel-browse.vala
src/plugins/external/rygel-external-container.vala

index b7c8af6..a4b6119 100644 (file)
@@ -95,7 +95,11 @@ internal class Rygel.Browse: Rygel.MediaQueryAction {
         }
 
         var container = (MediaContainer) media_object;
-        this.total_matches = container.child_count;
+        if (container.child_count < int.MAX) {
+            this.total_matches = container.child_count;
+        } else {
+            this.total_matches = 0;
+        }
 
         if (this.requested_count == 0) {
             // No max count requested, try to fetch all children
index 9991520..bc279ff 100644 (file)
@@ -48,7 +48,7 @@ public class Rygel.External.Container : Rygel.MediaContainer,
                       string     service_name,
                       string     path,
                       Container? parent = null) throws IOError {
-        base (id, parent, title, (int) child_count);
+        base (id, parent, title, (int) child_count.clamp (0, int.MAX));
 
         this.service_name = service_name;
         this.item_factory = new ItemFactory ();