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-08 11:52:57 +0000 |
commit | 275efcc6c493e01fcbb623de4a277cffd584fa58 (patch) | |
tree | 8cdaeb9a0b8c6c180595d35dbb5fabec840fcc97 | |
parent | 3ca1149275e1e63e11c8d97f696e05bf73d2e076 (diff) | |
download | qtlocation-275efcc6c493e01fcbb623de4a277cffd584fa58.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
Pick-To: 5.15
Change-Id: I99ab0f318b1c43b89888fffd160b589c5543b9d4
Coverity-Id: 226105
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-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; } |