On 27 Oct 2014, at 21:03, Lubomir I. Ivanov <[email protected]> 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

Attachment: 0001-Compare-image-times-and-sample-times-as-signed-ints.patch
Description: Binary data

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to