mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-02 10:23:25 +08:00
The GPS message is a run of fixed-width ASCII fields, each exactly as wide as the value it holds, with the terminating nul landing on the first byte of the field which follows it. Nothing bounded the formatted values, so an out-of-range input would overflow its field and shift everything after it, and gcc-16 rejects the latitude outright: AP_ADSB_Sagetech.cpp:497: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=] Bound each component to the widest value its field can represent, and share the formatting between the two Sagetech drivers rather than duplicating it. The seconds of the time of fix are now formatted as an integer rather than as a float so that the width of the field is known; the milliseconds are rounded and carried into the seconds, which gives output identical to the previous "%06.3f" except on exact half-millisecond ties. The MXS driver converted its epoch to seconds through a double, which can round up to the following second at present-day epoch values; it now uses integer division. Built for sparknavi-blue, which master does not currently build.