From 597539ce39ab1054851f5aa96daa0fff29699e8f Mon Sep 17 00:00:00 2001 From: Jeremie Guichard Date: Thu, 23 Mar 2017 08:13:49 +0700 Subject: Fix double to int truncation in C++ code Wfloat-conversion enabled for C++ part of the code Fix warnings raised by the flag using lrint Original issue reported on the mailing list: The ascent/descent rates are sometimes not what is expected. E.g. setting the ascent rate to 10m/min results in an actual ascent rate of 9m/min. This is due to truncating the ascent rate preference, then effectively rounding up the time to reach each stop to 2s intervals. The result being that setting the ascent rate to 10m/min results in 20s to ascend 3m (9m/min), when it should be exactly 18s. Reported-by: John Smith Reported-by: Rick Walsh Signed-off-by: Jeremie Guichard --- desktop-widgets/globe.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'desktop-widgets/globe.cpp') diff --git a/desktop-widgets/globe.cpp b/desktop-widgets/globe.cpp index ebe1fdb1c..2bab4e83f 100644 --- a/desktop-widgets/globe.cpp +++ b/desktop-widgets/globe.cpp @@ -267,7 +267,7 @@ void GlobeGPS::centerOnDiveSite(struct dive_site *ds) // otherwise check to make sure we aren't still running an animation and then remember // the current zoom level if (currentZoomLevel == -1) { - currentZoomLevel = zoomFromDistance(3.0); + currentZoomLevel = lrint(zoomFromDistance(3.0)); centerOn(longitude, latitude); fixZoom(true); return; -- cgit v1.2.3-70-g09d2