[PATCH 1/2] Profile.c: Fix stepping through loop between sample points

Rick Walsh rickmwalsh at gmail.com
Sun Aug 30 15:13:56 PDT 2015


On 31 August 2015 at 02:16, Dirk Hohndel <dirk at hohndel.org> wrote:

> Could I get a more detailed commit message for this?
>
>
It appeared to be an obvious change once I worked out that there was a
hidden bug, but it's quite well hidden, so not actually obvious at all.
Yes, it does deserve a commit message.

If adjacent samples at times t0 and t1 are greater than time_stepsize apart,
this for loop steps through the time between samples to calculate tissue
tolerance incrementally at each intermediate time, j, (and interpolated
depth).

If the difference between t1 and t0 is not a multiple of time_stepsize,
immediately before the final increment time_stepsize needs to be reduced to
t1 - j so that j = t1 in the final increment.

This is necessary when:
    t1 - j < time_stepsize    (i.e. we are about to start the final
                increment, and time_stepsize needs to be
                reduced), and
    j < t1            (i.e. we didn't just do the final increment -
                without this condition time_stepsize would be
                set to zero, leading to an infinite loop)

Previously, the check was (j - t0 < time_stepsize), which always returns
false.


Cheers,

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20150831/457e61ff/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Profile.c-Fix-stepping-through-loop-between-sample-p.patch
Type: text/x-patch
Size: 1814 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20150831/457e61ff/attachment.bin>


More information about the subsurface mailing list