diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2020-05-02 16:05:22 -0700 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-05-20 14:09:45 +0200 |
commit | e73246b0e575a14bd88a84f67543b7e9b50960d5 (patch) | |
tree | c1b137a44cbd1a26619087bfa7440804e8d0bfeb | |
parent | cd7b64a59450069815ded66dca5f407a20cbb6ed (diff) | |
download | qtlocation-e73246b0e575a14bd88a84f67543b7e9b50960d5.tar.gz |
Fix incorrect iteration over a C array
Found by Clang 10:
error: expression does not compute the number of elements in this array; element type is 'const MapStyleData',
not 'QGeoMapType::MapStyle' [- Werror,-Wsizeof-array-div]
Instead, just use range-for.
Task-number: QTBUG-83666
Change-Id: I99ab0f318b1c43b89888fffd160b589c5543b9d4
Coverity-Id: 226105
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 275efcc6c493e01fcbb623de4a277cffd584fa58)
-rw-r--r-- | src/plugins/geoservices/esri/geomapsource.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/plugins/geoservices/esri/geomapsource.cpp b/src/plugins/geoservices/esri/geomapsource.cpp index 7a7d264f..6801aad5 100644 --- a/src/plugins/geoservices/esri/geomapsource.cpp +++ b/src/plugins/geoservices/esri/geomapsource.cpp @@ -90,9 +90,7 @@ QString GeoMapSource::toFormat(const QString &url) QGeoMapType::MapStyle GeoMapSource::mapStyle(const QString &styleString) { - for (unsigned int i = 0; i < sizeof(mapStyles)/sizeof(MapStyle); i++) { - const MapStyleData &mapStyle = mapStyles[i]; - + for (const MapStyleData &mapStyle : mapStyles) { if (styleString.compare(mapStyle.name, Qt::CaseInsensitive) == 0) return mapStyle.style; } |