AP_Terrain: fix snprintf buffer length warning

Also includes fix from Tridge to use MIN() instead of MAX()
This commit is contained in:
Peter Barker 2018-01-25 13:10:22 +11:00 committed by Randy Mackay
parent 8070c13963
commit adde7bc588

View File

@ -173,9 +173,9 @@ void AP_Terrain::open_file(void)
}
snprintf(p, 13, "/%c%02u%c%03u.DAT",
block.lat_degrees<0?'S':'N',
abs((int32_t)block.lat_degrees),
MIN(abs((int32_t)block.lat_degrees), 99),
block.lon_degrees<0?'W':'E',
abs((int32_t)block.lon_degrees));
MIN(abs((int32_t)block.lon_degrees), 999));
// create directory if need be
if (!directory_created) {