Fix rounding of GPS coordinates and saving of entry

Linus Torvalds torvalds at linux-foundation.org
Sun Feb 10 12:06:18 PST 2013


This fixes two bugs in GPS coordinate entry:

 (a) the rounding of the coordinates was wrong. Using "+ 0.5" only
works on positive values, use rint() ("round to nearest int") for
proper rounding in the general case.

 (b) we can't use gps_changed() in the gps_map_callback function,
because that will actually change the GPS data in the dive being
edited, which in turn will then cause us to later (when we *really*
want to change it) not match the master dive data any more, and think
we shouldn't edit the dive at all.

Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

This expands the previous patch to also fix the other problem I found.
GPS coordinate changing actually seems to work now.Before, it worked
only intermittently due to that second bug (which also interacted with
the first bug, causing even the *first* time you tried to change
coordinates to possibly fail)

People should probably test more cases of changing GPS coordinates - I
tried to test the different cases (and re-do my tests of "pick up
coordinates automatically when picking a name that matches a previous
dive with the same name), but clearly people hadn't picked up on the
"re-edit already edited dive" issue, or the "negative coordinates
rounded wrong" thing.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 1812 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130210/80cd85c7/attachment.obj>


More information about the subsurface mailing list