Opened 13 years ago

Closed 13 years ago

#552 closed defect/bug (fixed)

coord.c: coord_format() output

Reported by: mvglasow Owned by: KaZeR
Priority: minor Milestone:
Component: core Version: git master
Severity: Keywords:


I've noticed that the coord_format() function does not process the coord_format argument as described in the comments of the header file.

DEGREES_DECIMAL and DEGREES_MINUTES work as expected, but DEGREES_MINUTES_SECONDS returns NMEA style output, e.g. 4529.5000N instead of 45°29'30.00" N.

In case this is a bug (which I assume), I have a patch available and will submit it in the next few days. The patch, however, does change three more things as I originally developed it for my feature request in #549 and needed to touch the very same code lines for that:

  • Passing lat/lng values of 360 or over will result in the value being omitted from output altogether (needed when just the lat/lon part is needed, this was the only way to tell the function that). With "real" coordinates, this shouldn't be a problem.
  • The output contains units rather than just spaces, similar to the output in the internal GUI menu (45°29.5000'N rather than 45 29.5000 N).
  • Due to the fix, the output for DEGREES_MINUTES_SECONDS can be up to 36 bytes long (as opposed to 26 in the documentation), which may require bigger buffers in calling functions. As far as I can see, this will affect only one function (statusbar_gps_update() in gui_gtk_statusbar.c).

I've searched for code that calls this function and found the following:

popup.c - buffer size OK, changed format seems to be no problem since the text is used for screen output as far as I can tell.

osd_core.c - buffer size OK, no problems expected with new format as it is for screen output only

garmin_img.c - buffer size OK, not sure about the new formatting. What does this do with the formatted coordinates?

gui_gtk_statusbar.c - buffer size needs to be adapted in one place, new format should be OK as it is only used for screen output.

Change History (2)

comment:1 Changed 13 years ago by mvglasow

Just attached a patch to feature request #549 which will also fix the aforementioned bug. Unfortunately I have no way to test it so far...

comment:2 Changed 13 years ago by mvglasow (2)

  • Resolution set to fixed
  • Status changed from new to closed

Since #549 is implemented as of r3410, this one should be fixed as well.

Note: See TracTickets for help on using tickets.