core: Clamp the stop between start and length
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Thu, 1 Oct 2009 21:49:49 +0000 (00:49 +0300)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Thu, 1 Oct 2009 21:49:49 +0000 (00:49 +0300)
Instead of setting stop to be the maximum of stop and length, it should
instead be clamped between start and length.

src/rygel/rygel-http-seek.vala

index fd6977a..58959e4 100644 (file)
@@ -164,11 +164,7 @@ internal class Rygel.HTTPSeek : GLib.Object {
         }
 
         if (length > 0) {
-            if (stop >= 0.0) {
-                stop = double.max (stop, (double) length - 1);
-            } else {
-                stop = (double) length - 1;
-            }
+            stop = stop.clamp (start + 1, (double) length - 1);
         }
 
         value += start.to_string () + "-";