[rygel] core: Clamp the stop between start and length



commit 406fb4e70c97d64efeaddf0f9ac338b0c798e653
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Oct 2 00:49:49 2009 +0300

    core: Clamp the stop between start and length
    
    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 |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
---
diff --git a/src/rygel/rygel-http-seek.vala b/src/rygel/rygel-http-seek.vala
index fd6977a..58959e4 100644
--- a/src/rygel/rygel-http-seek.vala
+++ b/src/rygel/rygel-http-seek.vala
@@ -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 () + "-";



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