Fix rounding of GPS coordinates and saving of entry

Dirk Hohndel dirk at hohndel.org
Sun Feb 10 12:13:51 PST 2013


I had already applied the previous patch that you included again in this
one. So I took the second half of it and adjusted the commit message.

I verified that with this applied I can indeed change GPS location with
the map picker.

But please check that what's in master now is what you intended to be
there :-)

/D

Linus Torvalds <torvalds at linux-foundation.org> writes:

> 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.



More information about the subsurface mailing list