[PATCH 0/9] fix some warnings

Lubomir I. Ivanov neolit123 at gmail.com
Mon Oct 27 13:55:08 PDT 2014


On 27 October 2014 22:44, Robert Helling <helling at atdotde.de> wrote:
>
> On 27 Oct 2014, at 21:03, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
>
>
> this is Robert's code (CC) so perhaps he or others have some ideas.
> on a brief look, DiveLogExportDialog::export_depths() would not always
> produce a correct depth value (depth.mm).
>
> given the times will not be that large for a realistic dive,
> s->time.seconds *should* be auto-converted to int32_t by the compiler,
> but also the pictures with negative offsets will be ignored as sample
> times are always positive.
>
> i don't exactly understand what the function does, but i think the
> comparison should consider the "dive->when", which is what both
> samples and pictures are based upon?.
>
>
> I am sorry that so many of your recent patches had to fix code that I had
> submitted. In this case, I would say that the comparison should be made with
> signed values (cast the duration to a signed int) as negative image time
> offsets are possible (pictures on the boat before the dive) while dives
> longer than 17 years are not.
>
> That while loop tries to find the last sample before the image was taken and
> use its depth as the depth of the image. If the time offset of the image is
> negative, this condition is never true and the initial depth of 0 is used.
>
> So, my shot at this problem would be in the present patch.
>

thanks for the explanation - it makes better sense to me now.
the explicit cast to int32_t fixes the warning.

ack.

lubomir
--


More information about the subsurface mailing list