[PATCH 0/9] fix some warnings

Robert Helling helling at atdotde.de
Mon Oct 27 13:44:21 PDT 2014


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.

Best
Robert

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20141027/94abfba0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Compare-image-times-and-sample-times-as-signed-ints.patch
Type: application/octet-stream
Size: 1161 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20141027/94abfba0/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20141027/94abfba0/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20141027/94abfba0/attachment.sig>


More information about the subsurface mailing list