[Kst] [PATCH] skip off-by-one

George Staikos staikos at kde.org
Thu Sep 22 18:07:41 CEST 2005


I haven't tested this enough to feel comfortable about it yet so I'd like some 
feedback.  I think we have an off-by-one bug in skip mode.  On planck data we 
were seeing occasional cases where the last value in the vector was not 
populated on an update, but there clearly was enough data for it.  This 
resulted in "going back in time" in the index/time vector, causing a line 
across the graph.  This patch fixes it.  The /Skip*Skip is necessary to get 
the integer rounding correct.  I will comment that before I commit.

Index: kstrvector.cpp
===================================================================
--- kstrvector.cpp      (revision 462954)
+++ kstrvector.cpp      (working copy)
@@ -468,7 +468,7 @@
   if (DoSkip) {
       // change new_f0 and new_nf so they both lie on skip boundaries
       if (new_f0 != 0) {
-        new_f0 = (((new_f0-1)/Skip)+1)*Skip;
+        new_f0 = (new_f0-1)/Skip*Skip;
       }
       new_nf = (new_nf/Skip)*Skip;
   }

-- 
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/


More information about the Kst mailing list