summaryrefslogtreecommitdiff
path: root/src/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp
diff options
context:
space:
mode:
authorJean Gressmann <jean.gressmann@nokia.com>2012-03-26 11:43:31 +0200
committerQt by Nokia <qt-info@nokia.com>2012-03-26 17:00:52 +0200
commit07846bc812be2a454ad7b70f7677407e80305372 (patch)
tree2cefc83625281027b88c8826c6f5f11968056583 /src/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp
parent81b6dd047ae6939f2d743cc7b6d0ef8794b6aab7 (diff)
downloadqtlocation-07846bc812be2a454ad7b70f7677407e80305372.tar.gz
QtLocation: Nokia plugin now returns an error on invalid travel modes
The plugin now returns an error if more than one travel mode flag is set at the same time. Change-Id: Iee8254c53c599b0e79ff701dc4e000ba4659a400 Reviewed-by: Alex Wilson <alex.wilson@nokia.com>
Diffstat (limited to 'src/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp')
-rw-r--r--src/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp b/src/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp
index b509c748..bc6e8234 100644
--- a/src/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp
+++ b/src/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp
@@ -223,6 +223,16 @@ bool QGeoRoutingManagerEngineNokia::checkEngineSupport(const QGeoRouteRequest &r
if ((travelModes & supportedTravelModes()) != travelModes)
return false;
+ // Count the number of set bits (= number of travel modes) (popcount)
+ int count = 0;
+
+ for (unsigned bits = travelModes; bits; bits >>= 1)
+ count += (bits & 1);
+
+ // We only allow one travel mode at a time
+ if (count != 1)
+ return false;
+
return true;
}