summaryrefslogtreecommitdiff
path: root/src/location
diff options
context:
space:
mode:
authorAlex Wilson <alex.wilson@nokia.com>2012-05-14 17:06:02 +1000
committerQt by Nokia <qt-info@nokia.com>2012-05-15 06:02:53 +0200
commit402f904f8c37e0b14ce07d49aaa391ee2d71de64 (patch)
treef50ba2ebfb4d65d1f61c586f30a3bb8317abbb5d /src/location
parent08c61718b83f93b2d27871e0e74cce838cc8fbf5 (diff)
downloadqtlocation-402f904f8c37e0b14ce07d49aaa391ee2d71de64.tar.gz
Coding style fixes, round #1
In this patch: * Assignment operators that don't check for self-assignment * Using const references where possible in function arguments * Using const refs in the iterator var of a foreach() loop * Add 'explicit' to constructors taking one parameter Change-Id: I640fd85c3312851f0d8c10193333efec41232e05 Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
Diffstat (limited to 'src/location')
-rw-r--r--src/location/maps/qgeocameracapabilities.cpp3
-rw-r--r--src/location/maps/qgeocameradata.cpp3
-rw-r--r--src/location/maps/qgeomaneuver.cpp3
-rw-r--r--src/location/maps/qgeomappingmanagerengine.h2
-rw-r--r--src/location/maps/qgeomapscene.cpp2
-rw-r--r--src/location/maps/qgeomaptype.cpp3
-rw-r--r--src/location/maps/qgeoroute.cpp3
-rw-r--r--src/location/maps/qgeoroutereply_p.h2
-rw-r--r--src/location/maps/qgeorouterequest.cpp3
-rw-r--r--src/location/maps/qgeorouterequest.h2
-rw-r--r--src/location/maps/qgeoroutesegment.cpp3
-rw-r--r--src/location/maps/qgeoserviceprovider.cpp2
-rw-r--r--src/location/maps/qgeotiledmapdata.cpp2
-rw-r--r--src/location/maps/qgeotiledmappingmanagerengine.h2
-rw-r--r--src/location/maps/qgeotilefetcher_p.h2
-rw-r--r--src/location/maps/qgeotilerequestmanager.cpp2
-rw-r--r--src/location/maps/qgeotilerequestmanager_p.h2
-rw-r--r--src/location/maps/qgeotilespec.cpp3
-rw-r--r--src/location/places/qplace.cpp3
-rw-r--r--src/location/places/qplaceattribute.cpp3
-rw-r--r--src/location/places/qplacecategory.cpp6
-rw-r--r--src/location/places/qplacecontactdetail.cpp3
-rw-r--r--src/location/places/qplacecontent.cpp3
-rw-r--r--src/location/places/qplacecontentrequest.cpp3
-rw-r--r--src/location/places/qplaceicon.cpp3
-rw-r--r--src/location/places/qplacematchrequest.cpp2
-rw-r--r--src/location/places/qplaceratings.cpp3
-rw-r--r--src/location/places/qplacesearchrequest.cpp3
-rw-r--r--src/location/places/qplacesearchresult.cpp6
-rw-r--r--src/location/places/qplacesupplier.cpp6
-rw-r--r--src/location/places/qplaceuser.cpp3
-rw-r--r--src/location/qgeoaddress.cpp3
-rw-r--r--src/location/qgeoareamonitor_polling_p.h2
-rw-r--r--src/location/qgeoboundingarea.cpp3
-rw-r--r--src/location/qgeoboundingarea_p.h2
-rw-r--r--src/location/qgeoboundingbox.cpp3
-rw-r--r--src/location/qgeoboundingcircle.cpp3
-rw-r--r--src/location/qgeocoordinate.cpp3
-rw-r--r--src/location/qgeolocation.cpp6
-rw-r--r--src/location/qgeopositioninfosource.cpp2
-rw-r--r--src/location/qgeosatelliteinfosource.cpp2
41 files changed, 103 insertions, 17 deletions
diff --git a/src/location/maps/qgeocameracapabilities.cpp b/src/location/maps/qgeocameracapabilities.cpp
index 3752affd..ab938abb 100644
--- a/src/location/maps/qgeocameracapabilities.cpp
+++ b/src/location/maps/qgeocameracapabilities.cpp
@@ -146,6 +146,9 @@ QGeoCameraCapabilities::~QGeoCameraCapabilities() {}
*/
QGeoCameraCapabilities& QGeoCameraCapabilities::operator = (const QGeoCameraCapabilities &other)
{
+ if (this == &other)
+ return *this;
+
d = other.d;
return *this;
}
diff --git a/src/location/maps/qgeocameradata.cpp b/src/location/maps/qgeocameradata.cpp
index 9c5b9839..f9d2d4bf 100644
--- a/src/location/maps/qgeocameradata.cpp
+++ b/src/location/maps/qgeocameradata.cpp
@@ -158,6 +158,9 @@ QGeoCameraData::~QGeoCameraData()
QGeoCameraData& QGeoCameraData::operator = (const QGeoCameraData &other)
{
+ if (this == &other)
+ return *this;
+
d = other.d;
return *this;
}
diff --git a/src/location/maps/qgeomaneuver.cpp b/src/location/maps/qgeomaneuver.cpp
index 50b5e56c..4a63d8b4 100644
--- a/src/location/maps/qgeomaneuver.cpp
+++ b/src/location/maps/qgeomaneuver.cpp
@@ -139,6 +139,9 @@ QGeoManeuver::~QGeoManeuver() {}
*/
QGeoManeuver& QGeoManeuver::operator= (const QGeoManeuver & other)
{
+ if (this == &other)
+ return *this;
+
d_ptr = other.d_ptr;
return *this;
}
diff --git a/src/location/maps/qgeomappingmanagerengine.h b/src/location/maps/qgeomappingmanagerengine.h
index 9812c4c8..7c676e1f 100644
--- a/src/location/maps/qgeomappingmanagerengine.h
+++ b/src/location/maps/qgeomappingmanagerengine.h
@@ -75,7 +75,7 @@ class Q_LOCATION_EXPORT QGeoMappingManagerEngine : public QObject
Q_OBJECT
public:
- QGeoMappingManagerEngine(QObject *parent = 0);
+ explicit QGeoMappingManagerEngine(QObject *parent = 0);
virtual ~QGeoMappingManagerEngine();
virtual QGeoMapData* createMapData() = 0;
diff --git a/src/location/maps/qgeomapscene.cpp b/src/location/maps/qgeomapscene.cpp
index c8fb3375..665ed789 100644
--- a/src/location/maps/qgeomapscene.cpp
+++ b/src/location/maps/qgeomapscene.cpp
@@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE
class QGeoMapScenePrivate {
public:
- QGeoMapScenePrivate(QGeoMapScene *scene);
+ explicit QGeoMapScenePrivate(QGeoMapScene *scene);
~QGeoMapScenePrivate();
QSize screenSize_; // in pixels
diff --git a/src/location/maps/qgeomaptype.cpp b/src/location/maps/qgeomaptype.cpp
index ce8c9191..331b32c3 100644
--- a/src/location/maps/qgeomaptype.cpp
+++ b/src/location/maps/qgeomaptype.cpp
@@ -57,6 +57,9 @@ QGeoMapType::~QGeoMapType() {}
QGeoMapType& QGeoMapType::operator = (const QGeoMapType &other)
{
+ if (this == &other)
+ return *this;
+
d_ptr = other.d_ptr;
return *this;
}
diff --git a/src/location/maps/qgeoroute.cpp b/src/location/maps/qgeoroute.cpp
index a641a1de..bc8151e0 100644
--- a/src/location/maps/qgeoroute.cpp
+++ b/src/location/maps/qgeoroute.cpp
@@ -97,6 +97,9 @@ QGeoRoute::~QGeoRoute()
*/
QGeoRoute& QGeoRoute::operator= (const QGeoRoute & other)
{
+ if (this == &other)
+ return *this;
+
d_ptr = other.d_ptr;
return *this;
}
diff --git a/src/location/maps/qgeoroutereply_p.h b/src/location/maps/qgeoroutereply_p.h
index ed899b32..fa9fcdbd 100644
--- a/src/location/maps/qgeoroutereply_p.h
+++ b/src/location/maps/qgeoroutereply_p.h
@@ -65,7 +65,7 @@ class QGeoRoute;
class QGeoRouteReplyPrivate
{
public:
- QGeoRouteReplyPrivate(const QGeoRouteRequest &request);
+ explicit QGeoRouteReplyPrivate(const QGeoRouteRequest &request);
QGeoRouteReplyPrivate(QGeoRouteReply::Error error, QString errorString);
~QGeoRouteReplyPrivate();
diff --git a/src/location/maps/qgeorouterequest.cpp b/src/location/maps/qgeorouterequest.cpp
index 2f9f3d39..1278cb51 100644
--- a/src/location/maps/qgeorouterequest.cpp
+++ b/src/location/maps/qgeorouterequest.cpp
@@ -257,6 +257,9 @@ QGeoRouteRequest::~QGeoRouteRequest() {}
*/
QGeoRouteRequest& QGeoRouteRequest::operator= (const QGeoRouteRequest & other)
{
+ if (this == &other)
+ return *this;
+
d_ptr = other.d_ptr;
return *this;
}
diff --git a/src/location/maps/qgeorouterequest.h b/src/location/maps/qgeorouterequest.h
index 9af96f7f..0e6b0d8d 100644
--- a/src/location/maps/qgeorouterequest.h
+++ b/src/location/maps/qgeorouterequest.h
@@ -112,7 +112,7 @@ public:
};
Q_DECLARE_FLAGS(ManeuverDetails, ManeuverDetail)
- QGeoRouteRequest(const QList<QGeoCoordinate> &waypoints = QList<QGeoCoordinate>());
+ explicit QGeoRouteRequest(const QList<QGeoCoordinate> &waypoints = QList<QGeoCoordinate>());
QGeoRouteRequest(const QGeoCoordinate &origin,
const QGeoCoordinate &destination);
QGeoRouteRequest(const QGeoRouteRequest &other);
diff --git a/src/location/maps/qgeoroutesegment.cpp b/src/location/maps/qgeoroutesegment.cpp
index 653dccd1..5264a5ac 100644
--- a/src/location/maps/qgeoroutesegment.cpp
+++ b/src/location/maps/qgeoroutesegment.cpp
@@ -98,6 +98,9 @@ QGeoRouteSegment::~QGeoRouteSegment() {}
*/
QGeoRouteSegment& QGeoRouteSegment::operator= (const QGeoRouteSegment & other)
{
+ if (this == &other)
+ return *this;
+
d_ptr = other.d_ptr;
return *this;
}
diff --git a/src/location/maps/qgeoserviceprovider.cpp b/src/location/maps/qgeoserviceprovider.cpp
index 628148cc..0bfdb660 100644
--- a/src/location/maps/qgeoserviceprovider.cpp
+++ b/src/location/maps/qgeoserviceprovider.cpp
@@ -181,7 +181,7 @@ Flags QGeoServiceProviderPrivate::features(const char *enumName)
if (this->metaData.contains(QStringLiteral("Features"))
&& this->metaData.value(QStringLiteral("Features")).isArray()) {
QJsonArray features = this->metaData.value(QStringLiteral("Features")).toArray();
- foreach (QJsonValue v, features) {
+ foreach (const QJsonValue &v, features) {
int val = en.keyToValue(v.toString().toLatin1().constData());
if (v.isString() && val != -1) {
ret |= typename Flags::enum_type(val);
diff --git a/src/location/maps/qgeotiledmapdata.cpp b/src/location/maps/qgeotiledmapdata.cpp
index 3fc294de..dbc8bb99 100644
--- a/src/location/maps/qgeotiledmapdata.cpp
+++ b/src/location/maps/qgeotiledmapdata.cpp
@@ -297,7 +297,7 @@ void QGeoTiledMapDataPrivate::changeCameraData(const QGeoCameraData &oldCameraDa
QList<QSharedPointer<QGeoTileTexture> > cachedTiles =
tileRequests_->requestTiles(visibleTiles_);
- foreach (QSharedPointer<QGeoTileTexture> tex, cachedTiles) {
+ foreach (const QSharedPointer<QGeoTileTexture> &tex, cachedTiles) {
mapScene_->addTile(tex->spec, tex);
}
diff --git a/src/location/maps/qgeotiledmappingmanagerengine.h b/src/location/maps/qgeotiledmappingmanagerengine.h
index 4d81415d..7b529c94 100644
--- a/src/location/maps/qgeotiledmappingmanagerengine.h
+++ b/src/location/maps/qgeotiledmappingmanagerengine.h
@@ -81,7 +81,7 @@ public:
};
Q_DECLARE_FLAGS(CacheAreas, CacheArea)
- QGeoTiledMappingManagerEngine(QObject *parent = 0);
+ explicit QGeoTiledMappingManagerEngine(QObject *parent = 0);
virtual ~QGeoTiledMappingManagerEngine();
QGeoTileFetcher *tileFetcher();
diff --git a/src/location/maps/qgeotilefetcher_p.h b/src/location/maps/qgeotilefetcher_p.h
index 14af709f..23eba010 100644
--- a/src/location/maps/qgeotilefetcher_p.h
+++ b/src/location/maps/qgeotilefetcher_p.h
@@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
class QGeoTileFetcherPrivate
{
public:
- QGeoTileFetcherPrivate(QGeoTiledMappingManagerEngine *engine);
+ explicit QGeoTileFetcherPrivate(QGeoTiledMappingManagerEngine *engine);
virtual ~QGeoTileFetcherPrivate();
QGeoTiledMappingManagerEngine *engine_;
diff --git a/src/location/maps/qgeotilerequestmanager.cpp b/src/location/maps/qgeotilerequestmanager.cpp
index d63a4f2a..f4fc791b 100644
--- a/src/location/maps/qgeotilerequestmanager.cpp
+++ b/src/location/maps/qgeotilerequestmanager.cpp
@@ -53,7 +53,7 @@ class RetryFuture;
class QGeoTileRequestManagerPrivate
{
public:
- QGeoTileRequestManagerPrivate(QGeoTiledMapData *map);
+ explicit QGeoTileRequestManagerPrivate(QGeoTiledMapData *map);
~QGeoTileRequestManagerPrivate();
QGeoTiledMapData *map_;
diff --git a/src/location/maps/qgeotilerequestmanager_p.h b/src/location/maps/qgeotilerequestmanager_p.h
index bc43f37d..3f394de8 100644
--- a/src/location/maps/qgeotilerequestmanager_p.h
+++ b/src/location/maps/qgeotilerequestmanager_p.h
@@ -70,7 +70,7 @@ class QGeoTileRequestManagerPrivate;
class QGeoTileRequestManager
{
public:
- QGeoTileRequestManager(QGeoTiledMapData *map);
+ explicit QGeoTileRequestManager(QGeoTiledMapData *map);
~QGeoTileRequestManager();
QList<QSharedPointer<QGeoTileTexture> > requestTiles(const QSet<QGeoTileSpec> &tiles);
diff --git a/src/location/maps/qgeotilespec.cpp b/src/location/maps/qgeotilespec.cpp
index 9ce3f1b8..cb768c37 100644
--- a/src/location/maps/qgeotilespec.cpp
+++ b/src/location/maps/qgeotilespec.cpp
@@ -58,6 +58,9 @@ QGeoTileSpec::~QGeoTileSpec() {
QGeoTileSpec& QGeoTileSpec::operator = (const QGeoTileSpec &other)
{
+ if (this == &other)
+ return *this;
+
d = other.d;
return *this;
}
diff --git a/src/location/places/qplace.cpp b/src/location/places/qplace.cpp
index 4446e459..926b0ce5 100644
--- a/src/location/places/qplace.cpp
+++ b/src/location/places/qplace.cpp
@@ -146,6 +146,9 @@ QPlace::~QPlace()
*/
QPlace &QPlace::operator= (const QPlace & other)
{
+ if (this == &other)
+ return *this;
+
d_ptr = other.d_ptr;
return *this;
}
diff --git a/src/location/places/qplaceattribute.cpp b/src/location/places/qplaceattribute.cpp
index c210697f..a0eff84e 100644
--- a/src/location/places/qplaceattribute.cpp
+++ b/src/location/places/qplaceattribute.cpp
@@ -163,6 +163,9 @@ QPlaceAttribute::QPlaceAttribute(const QPlaceAttribute &other)
*/
QPlaceAttribute &QPlaceAttribute::operator=(const QPlaceAttribute &other)
{
+ if (this == &other)
+ return *this;
+
d_ptr = other.d_ptr;
return *this;
}
diff --git a/src/location/places/qplacecategory.cpp b/src/location/places/qplacecategory.cpp
index fb7c8b67..73d641c3 100644
--- a/src/location/places/qplacecategory.cpp
+++ b/src/location/places/qplacecategory.cpp
@@ -61,6 +61,9 @@ QPlaceCategoryPrivate::~QPlaceCategoryPrivate()
QPlaceCategoryPrivate &QPlaceCategoryPrivate::operator=(const QPlaceCategoryPrivate &other)
{
+ if (this == &other)
+ return *this;
+
categoryId = other.categoryId;
name = other.name;
icon = other.icon;
@@ -127,6 +130,9 @@ QPlaceCategory::~QPlaceCategory()
*/
QPlaceCategory &QPlaceCategory::operator =(const QPlaceCategory &other)
{
+ if (this == &other)
+ return *this;
+
d = other.d;
return *this;
}
diff --git a/src/location/places/qplacecontactdetail.cpp b/src/location/places/qplacecontactdetail.cpp
index a7acc20c..5bc7fbe3 100644
--- a/src/location/places/qplacecontactdetail.cpp
+++ b/src/location/places/qplacecontactdetail.cpp
@@ -143,6 +143,9 @@ QPlaceContactDetail::QPlaceContactDetail(const QPlaceContactDetail &other)
*/
QPlaceContactDetail &QPlaceContactDetail::operator=(const QPlaceContactDetail &other)
{
+ if (this == &other)
+ return *this;
+
d_ptr = other.d_ptr;
return *this;
}
diff --git a/src/location/places/qplacecontent.cpp b/src/location/places/qplacecontent.cpp
index 0916ca12..d9032c0a 100644
--- a/src/location/places/qplacecontent.cpp
+++ b/src/location/places/qplacecontent.cpp
@@ -153,6 +153,9 @@ QPlaceContent::QPlaceContent(const QPlaceContent &other)
*/
QPlaceContent &QPlaceContent::operator=(const QPlaceContent &other)
{
+ if (this == &other)
+ return *this;
+
d_ptr = other.d_ptr;
return *this;
}
diff --git a/src/location/places/qplacecontentrequest.cpp b/src/location/places/qplacecontentrequest.cpp
index 00ca77f0..a48ffb37 100644
--- a/src/location/places/qplacecontentrequest.cpp
+++ b/src/location/places/qplacecontentrequest.cpp
@@ -125,6 +125,9 @@ QPlaceContentRequest::~QPlaceContentRequest()
*/
QPlaceContentRequest &QPlaceContentRequest::operator= (const QPlaceContentRequest & other)
{
+ if (this == &other)
+ return *this;
+
d_ptr = other.d_ptr;
return *this;
}
diff --git a/src/location/places/qplaceicon.cpp b/src/location/places/qplaceicon.cpp
index 5fa051b4..8db4dfe0 100644
--- a/src/location/places/qplaceicon.cpp
+++ b/src/location/places/qplaceicon.cpp
@@ -143,6 +143,9 @@ QPlaceIcon::~QPlaceIcon()
*/
QPlaceIcon &QPlaceIcon::operator=(const QPlaceIcon &other)
{
+ if (this == &other)
+ return *this;
+
d = other.d;
return *this;
}
diff --git a/src/location/places/qplacematchrequest.cpp b/src/location/places/qplacematchrequest.cpp
index 65568986..963ec977 100644
--- a/src/location/places/qplacematchrequest.cpp
+++ b/src/location/places/qplacematchrequest.cpp
@@ -156,6 +156,8 @@ QPlaceMatchRequest::~QPlaceMatchRequest()
*/
QPlaceMatchRequest &QPlaceMatchRequest::operator= (const QPlaceMatchRequest & other)
{
+ if (this == &other)
+ return *this;
d_ptr = other.d_ptr;
return *this;
}
diff --git a/src/location/places/qplaceratings.cpp b/src/location/places/qplaceratings.cpp
index 145b709f..7ce31bad 100644
--- a/src/location/places/qplaceratings.cpp
+++ b/src/location/places/qplaceratings.cpp
@@ -114,6 +114,9 @@ QPlaceRatings::~QPlaceRatings()
*/
QPlaceRatings &QPlaceRatings::operator=(const QPlaceRatings &other)
{
+ if (this == &other)
+ return *this;
+
d = other.d;
return *this;
}
diff --git a/src/location/places/qplacesearchrequest.cpp b/src/location/places/qplacesearchrequest.cpp
index a4c97ec1..05568000 100644
--- a/src/location/places/qplacesearchrequest.cpp
+++ b/src/location/places/qplacesearchrequest.cpp
@@ -210,6 +210,9 @@ QPlaceSearchRequest::~QPlaceSearchRequest()
*/
QPlaceSearchRequest &QPlaceSearchRequest::operator= (const QPlaceSearchRequest & other)
{
+ if (this == &other)
+ return *this;
+
d_ptr = other.d_ptr;
return *this;
}
diff --git a/src/location/places/qplacesearchresult.cpp b/src/location/places/qplacesearchresult.cpp
index 7f3204c1..0feb8f74 100644
--- a/src/location/places/qplacesearchresult.cpp
+++ b/src/location/places/qplacesearchresult.cpp
@@ -130,7 +130,11 @@ QPlaceSearchResult::~QPlaceSearchResult()
Assigns \a other to this search result and returns a reference to this
search result.
*/
-QPlaceSearchResult &QPlaceSearchResult::operator =(const QPlaceSearchResult &other) {
+QPlaceSearchResult &QPlaceSearchResult::operator =(const QPlaceSearchResult &other)
+{
+ if (this == &other)
+ return *this;
+
d = other.d;
return *this;
}
diff --git a/src/location/places/qplacesupplier.cpp b/src/location/places/qplacesupplier.cpp
index 3d86f35e..8d02b8ce 100644
--- a/src/location/places/qplacesupplier.cpp
+++ b/src/location/places/qplacesupplier.cpp
@@ -124,7 +124,11 @@ QPlaceSupplier::~QPlaceSupplier()
Assigns \a other to this supplier and returns a reference to this
supplier.
*/
-QPlaceSupplier &QPlaceSupplier::operator=(const QPlaceSupplier &other) {
+QPlaceSupplier &QPlaceSupplier::operator=(const QPlaceSupplier &other)
+{
+ if (this == &other)
+ return *this;
+
d = other.d;
return *this;
}
diff --git a/src/location/places/qplaceuser.cpp b/src/location/places/qplaceuser.cpp
index 75c77ba1..6473230f 100644
--- a/src/location/places/qplaceuser.cpp
+++ b/src/location/places/qplaceuser.cpp
@@ -101,6 +101,9 @@ QPlaceUser::~QPlaceUser()
*/
QPlaceUser &QPlaceUser::operator=(const QPlaceUser &other)
{
+ if (this == &other)
+ return *this;
+
d = other.d;
return *this;
}
diff --git a/src/location/qgeoaddress.cpp b/src/location/qgeoaddress.cpp
index 113f4bfd..43a81d4d 100644
--- a/src/location/qgeoaddress.cpp
+++ b/src/location/qgeoaddress.cpp
@@ -367,6 +367,9 @@ QGeoAddress::~QGeoAddress()
*/
QGeoAddress &QGeoAddress::operator=(const QGeoAddress & address)
{
+ if (this == &address)
+ return *this;
+
d = address.d;
return *this;
}
diff --git a/src/location/qgeoareamonitor_polling_p.h b/src/location/qgeoareamonitor_polling_p.h
index a913b8ad..849f7e0b 100644
--- a/src/location/qgeoareamonitor_polling_p.h
+++ b/src/location/qgeoareamonitor_polling_p.h
@@ -67,7 +67,7 @@ class QGeoAreaMonitorPolling : public QGeoAreaMonitor
Q_OBJECT
public :
- QGeoAreaMonitorPolling(QObject *parent = 0);
+ explicit QGeoAreaMonitorPolling(QObject *parent = 0);
~QGeoAreaMonitorPolling();
void setCenter(const QGeoCoordinate &coordinate);
void setRadius(qreal radius);
diff --git a/src/location/qgeoboundingarea.cpp b/src/location/qgeoboundingarea.cpp
index dbad8fec..195cda6c 100644
--- a/src/location/qgeoboundingarea.cpp
+++ b/src/location/qgeoboundingarea.cpp
@@ -198,6 +198,9 @@ bool QGeoBoundingArea::operator!=(const QGeoBoundingArea &other) const
QGeoBoundingArea &QGeoBoundingArea::operator=(const QGeoBoundingArea &other)
{
+ if (this == &other)
+ return *this;
+
d_ptr = other.d_ptr;
return *this;
}
diff --git a/src/location/qgeoboundingarea_p.h b/src/location/qgeoboundingarea_p.h
index ce0ba069..12387d94 100644
--- a/src/location/qgeoboundingarea_p.h
+++ b/src/location/qgeoboundingarea_p.h
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
class QGeoBoundingAreaPrivate : public QSharedData
{
public:
- QGeoBoundingAreaPrivate(QGeoBoundingArea::AreaType type);
+ explicit QGeoBoundingAreaPrivate(QGeoBoundingArea::AreaType type);
virtual ~QGeoBoundingAreaPrivate();
virtual bool isValid() const = 0;
diff --git a/src/location/qgeoboundingbox.cpp b/src/location/qgeoboundingbox.cpp
index 357ef07c..a5dc1801 100644
--- a/src/location/qgeoboundingbox.cpp
+++ b/src/location/qgeoboundingbox.cpp
@@ -148,6 +148,9 @@ QGeoBoundingBox::~QGeoBoundingBox() {}
*/
QGeoBoundingBox& QGeoBoundingBox::operator = (const QGeoBoundingBox & other)
{
+ if (this == &other)
+ return *this;
+
QGeoBoundingArea::operator=(other);
d_ptr = other.d_ptr;
return *this;
diff --git a/src/location/qgeoboundingcircle.cpp b/src/location/qgeoboundingcircle.cpp
index 3356e6c3..67736c70 100644
--- a/src/location/qgeoboundingcircle.cpp
+++ b/src/location/qgeoboundingcircle.cpp
@@ -121,6 +121,9 @@ QGeoBoundingCircle::~QGeoBoundingCircle() {}
*/
QGeoBoundingCircle& QGeoBoundingCircle::operator = (const QGeoBoundingCircle & other)
{
+ if (this == &other)
+ return *this;
+
QGeoBoundingArea::operator=(other);
d_ptr = other.d_ptr;
return *this;
diff --git a/src/location/qgeocoordinate.cpp b/src/location/qgeocoordinate.cpp
index ed8c0c07..833f0fab 100644
--- a/src/location/qgeocoordinate.cpp
+++ b/src/location/qgeocoordinate.cpp
@@ -192,6 +192,9 @@ QGeoCoordinate::QGeoCoordinate(const QGeoCoordinate &other)
QGeoCoordinate &QGeoCoordinate::operator=(const QGeoCoordinate &other)
{
+ if (this == &other)
+ return *this;
+
d = other.d;
return (*this);
}
diff --git a/src/location/qgeolocation.cpp b/src/location/qgeolocation.cpp
index 6a2b5f43..634d72b1 100644
--- a/src/location/qgeolocation.cpp
+++ b/src/location/qgeolocation.cpp
@@ -123,7 +123,11 @@ QGeoLocation::~QGeoLocation()
/*!
Assigns \a other to this location and returns a reference to this location.
*/
-QGeoLocation &QGeoLocation::operator =(const QGeoLocation &other) {
+QGeoLocation &QGeoLocation::operator =(const QGeoLocation &other)
+{
+ if (this == &other)
+ return *this;
+
d = other.d;
return *this;
}
diff --git a/src/location/qgeopositioninfosource.cpp b/src/location/qgeopositioninfosource.cpp
index 0434af8e..d7f45ebd 100644
--- a/src/location/qgeopositioninfosource.cpp
+++ b/src/location/qgeopositioninfosource.cpp
@@ -276,7 +276,7 @@ QGeoPositionInfoSource *QGeoPositionInfoSource::createDefaultSource(QObject *par
QGeoPositionInfoSourcePrivate *d = new QGeoPositionInfoSourcePrivate;
QList<QJsonObject> plugins = QGeoPositionInfoSourcePrivate::pluginsSorted();
- foreach (QJsonObject obj, plugins) {
+ foreach (const QJsonObject &obj, plugins) {
if (obj.value(QStringLiteral("Position")).isBool()
&& obj.value(QStringLiteral("Position")).toBool()) {
d->metaData = obj;
diff --git a/src/location/qgeosatelliteinfosource.cpp b/src/location/qgeosatelliteinfosource.cpp
index 2dbb1068..33c7054e 100644
--- a/src/location/qgeosatelliteinfosource.cpp
+++ b/src/location/qgeosatelliteinfosource.cpp
@@ -160,7 +160,7 @@ QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createDefaultSource(QObject *p
QGeoPositionInfoSourcePrivate *d = new QGeoPositionInfoSourcePrivate;
QList<QJsonObject> plugins = QGeoPositionInfoSourcePrivate::pluginsSorted();
- foreach (QJsonObject obj, plugins) {
+ foreach (const QJsonObject &obj, plugins) {
if (obj.value(QStringLiteral("Satellite")).isBool()
&& obj.value(QStringLiteral("Satellite")).toBool()) {
d->metaData = obj;