[PATCH 2/7] gpslocation.cpp: fix signed vs unsinged int comparison warning

Lubomir I. Ivanov neolit123 at gmail.com
Wed Nov 18 13:46:55 PST 2015


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

QDateTime::toTime_t() is misleading as it does not return
a C time_t type, but a 'unsigned int' or rather the Qt
'uint' typedef.

To prevent the warning we cast it to 'time_t' and to
comply with the 'lastTime' variable.

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
 qt-mobile/gpslocation.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qt-mobile/gpslocation.cpp b/qt-mobile/gpslocation.cpp
index e34ae39..b335486 100644
--- a/qt-mobile/gpslocation.cpp
+++ b/qt-mobile/gpslocation.cpp
@@ -58,7 +58,7 @@ void GpsLocation::newPosition(QGeoPositionInfo pos)
 	// if we have no record stored or if at least the configured minimum
 	// time has passed or we moved at least the configured minimum distance
 	if (!nr ||
-	    pos.timestamp().toTime_t() > lastTime + prefs.time_threshold ||
+	    (time_t)pos.timestamp().toTime_t() > lastTime + prefs.time_threshold ||
 	    lastCoord.distanceTo(pos.coordinate()) > prefs.distance_threshold) {
 		geoSettings->setValue("count", nr + 1);
 		geoSettings->setValue(QString("gpsFix%1_time").arg(nr), pos.timestamp().toTime_t());
-- 
1.7.11.msysgit.0



More information about the subsurface mailing list