[Kst] [PATCH] skip off-by-one
George Staikos
staikos at kde.org
Fri Sep 23 14:52:19 CEST 2005
On Thursday 22 September 2005 13:28, Barth Netterfield wrote:
> The new code is wrong. It always rounds down, even if you start on a skip
> boundry:
> new_f0 = 2, skip = 2:
> old: ((2-1)/2 + 1) *2 = 2
> new: (2-1)/2*2 = 0
>
> new_f0 = 1, skip = 2
> old: ((1-1)/2 + 1) * 2 = 2;
> new: (1-1)/2*2 = 0;
>
> new_f0 = 0 skip = 1 (eg, more than 1 spf, want only 1 spf)
> old: (0-1)/1+1) * 1= 0
> new: (0-1)/1 * 1 = -1
>
> The new code rounds up to the next skip boundry. The only trouble with
> this might come if new_f0 between the last skip boundry and the end of the
> file.
>
> Check the nf calculations...
Of course you're right. The bug is elsewhere. I'm trying to track it down,
but I just finally found the infamous random crash with threads. This is
probably the one Matt saw too. kdDebug() is not threadsafe!! I'm going to
have to fix it before I finish tracking down this skip bug. it's impossible
to debug right now. I'll probably have to import our own fork of kdDebug and
then make a patch for KDE 3.5. I recommended a redesign of kdebug for 4.0.
--
George Staikos
KDE Developer http://www.kde.org/
Staikos Computing Services Inc. http://www.staikos.net/
More information about the Kst
mailing list