diff options
author | Alex Wilson <alex.wilson@nokia.com> | 2012-04-17 16:56:54 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-04-19 10:10:01 +0200 |
commit | 75b9e531b922ff123fd85c6df238cb199e648e15 (patch) | |
tree | c266e0ae94c36ff6b909b05ee889efd139aca602 /src | |
parent | ca5336e974e2eeac15b39da2e3daf98485c50980 (diff) |
Coverity and compiler warning fixes
Change-Id: Iae536630edbfbda2c0e8c67c48477d5867d25f07
Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
Diffstat (limited to 'src')
21 files changed, 65 insertions, 22 deletions
diff --git a/src/imports/location/qdeclarativegeomapitembase.cpp b/src/imports/location/qdeclarativegeomapitembase.cpp index ee264e78..a337b9ff 100644 --- a/src/imports/location/qdeclarativegeomapitembase.cpp +++ b/src/imports/location/qdeclarativegeomapitembase.cpp @@ -57,15 +57,25 @@ QGeoMapViewportChangeEvent::QGeoMapViewportChangeEvent() } QGeoMapViewportChangeEvent::QGeoMapViewportChangeEvent(const QGeoMapViewportChangeEvent &other) - : cameraData(other.cameraData), - mapSize(other.mapSize), - zoomLevelChanged(other.zoomLevelChanged), - centerChanged(other.centerChanged), - mapSizeChanged(other.mapSizeChanged), - tiltChanged(other.tiltChanged), - bearingChanged(other.bearingChanged), - rollChanged(other.rollChanged) { + this->operator=(other); +} + +QGeoMapViewportChangeEvent &QGeoMapViewportChangeEvent::operator=(const QGeoMapViewportChangeEvent &other) +{ + if (this == &other) + return (*this); + + cameraData = other.cameraData; + mapSize = other.mapSize; + zoomLevelChanged = other.zoomLevelChanged; + centerChanged = other.centerChanged; + mapSizeChanged = other.mapSizeChanged; + tiltChanged = other.tiltChanged; + bearingChanged = other.bearingChanged; + rollChanged = other.rollChanged; + + return (*this); } QDeclarativeGeoMapItemBase::QDeclarativeGeoMapItemBase(QQuickItem *parent) diff --git a/src/imports/location/qdeclarativegeomapitembase_p.h b/src/imports/location/qdeclarativegeomapitembase_p.h index 3d2fed6e..7469f8f0 100644 --- a/src/imports/location/qdeclarativegeomapitembase_p.h +++ b/src/imports/location/qdeclarativegeomapitembase_p.h @@ -54,6 +54,7 @@ class QGeoMapViewportChangeEvent public: QGeoMapViewportChangeEvent(); QGeoMapViewportChangeEvent(const QGeoMapViewportChangeEvent &other); + QGeoMapViewportChangeEvent &operator=(const QGeoMapViewportChangeEvent &other); QGeoCameraData cameraData; QSizeF mapSize; diff --git a/src/imports/location/qdeclarativegeomapquickitem.cpp b/src/imports/location/qdeclarativegeomapquickitem.cpp index 0843882e..f4dc1f1b 100644 --- a/src/imports/location/qdeclarativegeomapquickitem.cpp +++ b/src/imports/location/qdeclarativegeomapquickitem.cpp @@ -381,7 +381,7 @@ void QDeclarativeGeoMapQuickItem::updateMapItem() */ void QDeclarativeGeoMapQuickItem::afterViewportChanged(const QGeoMapViewportChangeEvent &event) { - // do nothing + Q_UNUSED(event); } /*! diff --git a/src/imports/location/qdeclarativepolygonmapitem.cpp b/src/imports/location/qdeclarativepolygonmapitem.cpp index bd0dd7a4..7cc4eae7 100644 --- a/src/imports/location/qdeclarativepolygonmapitem.cpp +++ b/src/imports/location/qdeclarativepolygonmapitem.cpp @@ -561,7 +561,7 @@ void MapPolygonNode::update(const QColor& fillColor, const QColor& borderColor, fill->allocate(fillShape->size()); Vertex *vertices = (Vertex *)fill->vertexData(); - for (int i = 0; i < fillShape->size(); ++i) + for (uint i = 0; i < fillShape->size(); ++i) vertices[fillVertexCount++].position = fillShape->vertex(i); Q_ASSERT(fillVertexCount == fill->vertexCount()); diff --git a/src/imports/location/qdeclarativepolylinemapitem.cpp b/src/imports/location/qdeclarativepolylinemapitem.cpp index ac720133..d9d6a42c 100644 --- a/src/imports/location/qdeclarativepolylinemapitem.cpp +++ b/src/imports/location/qdeclarativepolylinemapitem.cpp @@ -715,7 +715,7 @@ void MapPolylineNode::update(const QColor& fillColor, Vertex *vertices = (Vertex *)fill->vertexData(); - for (int i = 0; i < shape->size(); ++i) { + for (uint i = 0; i < shape->size(); ++i) { vertices[fillVertexCount++].position = shape->vertex(i); } diff --git a/src/location/maps/qcache3q_p.h b/src/location/maps/qcache3q_p.h index 84ab2bb9..b744583c 100644 --- a/src/location/maps/qcache3q_p.h +++ b/src/location/maps/qcache3q_p.h @@ -177,6 +177,11 @@ private: void rebalance(); void unlink(Node *n); void link_front(Node *n, Queue *q); + +private: + // make these private so they can't be used + inline QCache3Q(const QCache3Q<Key,T,EvPolicy> &) {} + inline QCache3Q<Key,T,EvPolicy> &operator=(const QCache3Q<Key,T,EvPolicy> &) {} }; template <class Key, class T, class EvPolicy> @@ -233,7 +238,7 @@ bool QCache3Q<Key,T,EvPolicy>::insert(const Key &key, QSharedPointer<T> object, n->q->cost += cost; if (n->q == q1_evicted_) { - if (n->pop > promote_) { + if (n->pop > (uint)promote_) { unlink(n); link_front(n, q2_); rebalance(); diff --git a/src/location/maps/qgeocameracapabilities.cpp b/src/location/maps/qgeocameracapabilities.cpp index da82f864..3752affd 100644 --- a/src/location/maps/qgeocameracapabilities.cpp +++ b/src/location/maps/qgeocameracapabilities.cpp @@ -93,6 +93,9 @@ QGeoCameraCapabilitiesPrivate::~QGeoCameraCapabilitiesPrivate() {} QGeoCameraCapabilitiesPrivate& QGeoCameraCapabilitiesPrivate::operator = (const QGeoCameraCapabilitiesPrivate &other) { + if (this == &other) + return *this; + supportsBearing_ = other.supportsBearing_; supportsRolling_ = other.supportsRolling_; supportsTilting_ = other.supportsTilting_; diff --git a/src/location/maps/qgeocameradata.cpp b/src/location/maps/qgeocameradata.cpp index 54bb08ea..9c5b9839 100644 --- a/src/location/maps/qgeocameradata.cpp +++ b/src/location/maps/qgeocameradata.cpp @@ -89,6 +89,9 @@ QGeoCameraDataPrivate::QGeoCameraDataPrivate(const QGeoCameraDataPrivate &rhs) QGeoCameraDataPrivate& QGeoCameraDataPrivate::operator = (const QGeoCameraDataPrivate &rhs) { + if (this == &rhs) + return *this; + center_ = rhs.center_; bearing_ = rhs.bearing_; tilt_ = rhs.tilt_; diff --git a/src/location/maps/qgeocameratiles_p.h b/src/location/maps/qgeocameratiles_p.h index 5f9c6a1e..dfc8cdf3 100644 --- a/src/location/maps/qgeocameratiles_p.h +++ b/src/location/maps/qgeocameratiles_p.h @@ -86,6 +86,7 @@ public: private: QGeoCameraTilesPrivate *d_ptr; Q_DECLARE_PRIVATE(QGeoCameraTiles) + Q_DISABLE_COPY(QGeoCameraTiles) }; QT_END_NAMESPACE diff --git a/src/location/maps/qgeomapdata_p.h b/src/location/maps/qgeomapdata_p.h index a652d617..aa38880f 100644 --- a/src/location/maps/qgeomapdata_p.h +++ b/src/location/maps/qgeomapdata_p.h @@ -126,6 +126,7 @@ Q_SIGNALS: private: QGeoMapDataPrivate *d_ptr; Q_DECLARE_PRIVATE(QGeoMapData) + Q_DISABLE_COPY(QGeoMapData) }; QT_END_NAMESPACE diff --git a/src/location/maps/qgeomapgeometry_p.h b/src/location/maps/qgeomapgeometry_p.h index 124c1605..fb39e0ad 100644 --- a/src/location/maps/qgeomapgeometry_p.h +++ b/src/location/maps/qgeomapgeometry_p.h @@ -108,6 +108,7 @@ Q_SIGNALS: private: QGeoMapGeometryPrivate *d_ptr; Q_DECLARE_PRIVATE(QGeoMapGeometry) + Q_DISABLE_COPY(QGeoMapGeometry) }; QT_END_NAMESPACE diff --git a/src/location/maps/qgeomapimages_p.h b/src/location/maps/qgeomapimages_p.h index e616d50c..02ceb15e 100644 --- a/src/location/maps/qgeomapimages_p.h +++ b/src/location/maps/qgeomapimages_p.h @@ -80,6 +80,7 @@ public: private: QGeoMapImagesPrivate *d_ptr; Q_DECLARE_PRIVATE(QGeoMapImages) + Q_DISABLE_COPY(QGeoMapImages) }; QT_END_NAMESPACE diff --git a/src/location/maps/qgeomappingmanager.cpp b/src/location/maps/qgeomappingmanager.cpp index abfc47ea..3b74b68d 100644 --- a/src/location/maps/qgeomappingmanager.cpp +++ b/src/location/maps/qgeomappingmanager.cpp @@ -138,7 +138,7 @@ QGeoCameraCapabilities QGeoMappingManager::cameraCapabilities() const QGeoMap *QGeoMappingManager::createMap(QObject *parent) { QGeoMapData *mapData = d_ptr->engine->createMapData(); - QGeoMap *map = new QGeoMap(mapData); + QGeoMap *map = new QGeoMap(mapData, parent); return map; } diff --git a/src/location/maps/qgeotiledmapdata_p.h b/src/location/maps/qgeotiledmapdata_p.h index 7458c112..4313f1c1 100644 --- a/src/location/maps/qgeotiledmapdata_p.h +++ b/src/location/maps/qgeotiledmapdata_p.h @@ -97,6 +97,7 @@ protected Q_SLOTS: private: QGeoTiledMapDataPrivate *d_ptr; Q_DECLARE_PRIVATE(QGeoTiledMapData) + Q_DISABLE_COPY(QGeoTiledMapData) }; diff --git a/src/location/maps/qgeotiledmapdata_p_p.h b/src/location/maps/qgeotiledmapdata_p_p.h index addcb6fc..97f83949 100644 --- a/src/location/maps/qgeotiledmapdata_p_p.h +++ b/src/location/maps/qgeotiledmapdata_p_p.h @@ -113,6 +113,8 @@ private: QGeoCameraTiles *cameraTiles_; QGeoMapGeometry *mapGeometry_; QGeoMapImages *mapImages_; + + Q_DISABLE_COPY(QGeoTiledMapDataPrivate) }; QT_END_NAMESPACE diff --git a/src/location/maps/qgeotilefetcher.cpp b/src/location/maps/qgeotilefetcher.cpp index 6ebde313..8080706c 100644 --- a/src/location/maps/qgeotilefetcher.cpp +++ b/src/location/maps/qgeotilefetcher.cpp @@ -216,10 +216,10 @@ void QGeoTileFetcher::handleReply(QGeoTiledMapReply *reply, const QGeoTileSpec & *******************************************************************************/ QGeoTileFetcherPrivate::QGeoTileFetcherPrivate(QGeoTiledMappingManagerEngine *engine) - : started_(false), + : engine_(engine), + started_(false), stopped_(false), - timer_(0), - engine_(engine) {} + timer_(0) {} QGeoTileFetcherPrivate::~QGeoTileFetcherPrivate() { diff --git a/src/location/maps/qgeotilespec.cpp b/src/location/maps/qgeotilespec.cpp index 342706fa..9ce3f1b8 100644 --- a/src/location/maps/qgeotilespec.cpp +++ b/src/location/maps/qgeotilespec.cpp @@ -158,11 +158,15 @@ QGeoTileSpecPrivate::~QGeoTileSpecPrivate() {} QGeoTileSpecPrivate& QGeoTileSpecPrivate::operator = (const QGeoTileSpecPrivate &other) { + if (this == &other) + return *this; + plugin_ = other.plugin_; mapId_ = other.mapId_; zoom_ = other.zoom_; x_ = other.x_; y_ = other.y_; + return *this; } diff --git a/src/location/places/qplace.cpp b/src/location/places/qplace.cpp index 9ce10e3d..72bf3cee 100644 --- a/src/location/places/qplace.cpp +++ b/src/location/places/qplace.cpp @@ -645,6 +645,9 @@ QPlacePrivate::~QPlacePrivate() {} QPlacePrivate& QPlacePrivate::operator= (const QPlacePrivate & other) { + if (this == &other) + return *this; + categories = other.categories; location = other.location; ratings = other.ratings; diff --git a/src/location/places/qplaceicon.cpp b/src/location/places/qplaceicon.cpp index 21064a1b..5fa051b4 100644 --- a/src/location/places/qplaceicon.cpp +++ b/src/location/places/qplaceicon.cpp @@ -64,8 +64,12 @@ QPlaceIconPrivate::~QPlaceIconPrivate() QPlaceIconPrivate &QPlaceIconPrivate::operator=(const QPlaceIconPrivate &other) { + if (this == &other) + return *this; + manager = other.manager; parameters = other.parameters; + return *this; } diff --git a/src/location/qgeoaddress.cpp b/src/location/qgeoaddress.cpp index 44423307..f50d8657 100644 --- a/src/location/qgeoaddress.cpp +++ b/src/location/qgeoaddress.cpp @@ -287,7 +287,8 @@ static QString formattedAddress(const QGeoAddress &address, } QGeoAddressPrivate::QGeoAddressPrivate() - : QSharedData() + : QSharedData(), + m_autoGeneratedText(false) { } @@ -301,7 +302,8 @@ QGeoAddressPrivate::QGeoAddressPrivate(const QGeoAddressPrivate &other) sDistrict(other.sDistrict), sStreet(other.sStreet), sPostalCode(other.sPostalCode), - sText(other.sText) + sText(other.sText), + m_autoGeneratedText(false) { } diff --git a/src/plugins/geoservices/nokia/qgeotilefetcher_nokia.cpp b/src/plugins/geoservices/nokia/qgeotilefetcher_nokia.cpp index ad4e56d6..777548ea 100644 --- a/src/plugins/geoservices/nokia/qgeotilefetcher_nokia.cpp +++ b/src/plugins/geoservices/nokia/qgeotilefetcher_nokia.cpp @@ -72,10 +72,11 @@ const char* MAPTILES_HOST_CN = "a-k.maptile.maps.svc.nokia.com.cn"; QGeoTileFetcherNokia::QGeoTileFetcherNokia(QGeoTiledMappingManagerEngine *engine) : QGeoTileFetcher(engine), - m_networkManager(0), - m_firstSubdomain(QChar::Null), - m_maxSubdomains(0), - m_engineNokia(static_cast<QGeoTiledMappingManagerEngineNokia*>(engine)) {} + m_engineNokia(static_cast<QGeoTiledMappingManagerEngineNokia*>(engine)), + m_networkManager(0), + m_firstSubdomain(QChar::Null), + m_copyrightsReply(0), + m_maxSubdomains(0) {} QGeoTileFetcherNokia::~QGeoTileFetcherNokia() {} |