diff --git a/src/analysis/interpolation/DualEdgeTriangulation.cc b/src/analysis/interpolation/DualEdgeTriangulation.cc index 8853879810b3..b5c99cb4f29c 100644 --- a/src/analysis/interpolation/DualEdgeTriangulation.cc +++ b/src/analysis/interpolation/DualEdgeTriangulation.cc @@ -462,12 +462,12 @@ int DualEdgeTriangulation::baseEdgeOfPoint( int point ) return actedge; } - else if ( leftofnumber <= 0 ) + else if ( leftofnumber <= 0.0 ) { actedge = mHalfEdge[actedge]->getNext(); } - else if ( leftofnumber > 0 ) + else { actedge = mHalfEdge[mHalfEdge[mHalfEdge[mHalfEdge[actedge]->getDual()]->getNext()]->getNext()]->getDual(); } diff --git a/src/app/ogr/qgsvectorlayersaveasdialog.cpp b/src/app/ogr/qgsvectorlayersaveasdialog.cpp index c84d0ddbec70..2e945ca3213e 100644 --- a/src/app/ogr/qgsvectorlayersaveasdialog.cpp +++ b/src/app/ogr/qgsvectorlayersaveasdialog.cpp @@ -248,9 +248,8 @@ void QgsVectorLayerSaveAsDialog::on_mFormatComboBox_currentIndexChanged( int idx bool foundFieldThatCanBeExportedAsDisplayedValue = false; for ( int i = 0; i < mLayer->fields().size(); ++i ) { - QgsEditorWidgetFactory *factory; if ( mLayer->editFormConfig()->widgetType( i ) != "TextEdit" && - ( factory = QgsEditorWidgetRegistry::instance()->factory( mLayer->editFormConfig()->widgetType( i ) ) ) ) + QgsEditorWidgetRegistry::instance()->factory( mLayer->editFormConfig()->widgetType( i ) ) ) { foundFieldThatCanBeExportedAsDisplayedValue = true; break; diff --git a/src/app/qgsmaptoolfillring.cpp b/src/app/qgsmaptoolfillring.cpp index bd213dd4a5f6..d70bbe334a9c 100644 --- a/src/app/qgsmaptoolfillring.cpp +++ b/src/app/qgsmaptoolfillring.cpp @@ -141,7 +141,6 @@ void QgsMapToolFillRing::cadCanvasReleaseEvent( QgsMapMouseEvent * e ) QgsFeatureIterator fit = vlayer->getFeatures( QgsFeatureRequest().setFilterFid( modifiedFid ) ); QgsFeature f; - bool res = false; if ( fit.nextFeature( f ) ) { //create QgsFeature with wkb representation @@ -150,6 +149,7 @@ void QgsMapToolFillRing::cadCanvasReleaseEvent( QgsMapMouseEvent * e ) ft->setGeometry( QgsGeometry::fromPolygon( QgsPolygon() << pointList.toVector() ) ); ft->setAttributes( f.attributes() ); + bool res = false; if ( QApplication::keyboardModifiers() == Qt::ControlModifier ) { res = vlayer->addFeature( *ft ); @@ -170,7 +170,6 @@ void QgsMapToolFillRing::cadCanvasReleaseEvent( QgsMapMouseEvent * e ) delete ft; vlayer->destroyEditCommand(); } - res = false; } } stopCapturing(); diff --git a/src/core/composer/qgscomposermap.cpp b/src/core/composer/qgscomposermap.cpp index c0c8bc07b52e..d7adf0cf0d3c 100644 --- a/src/core/composer/qgscomposermap.cpp +++ b/src/core/composer/qgscomposermap.cpp @@ -836,7 +836,7 @@ void QgsComposerMap::setNewAtlasFeatureExtent( const QgsRectangle& extent ) newExtent.setYMinimum( extent.yMinimum() - deltaHeight / 2 ); newExtent.setYMaximum( extent.yMaximum() + deltaHeight / 2 ); } - else if ( currentWidthHeightRatio >= newWidthHeightRatio ) + else { //enlarge width of new extent, ensuring the map center stays the same double newWidth = currentWidthHeightRatio * newExtent.height(); diff --git a/src/core/geometry/qgsinternalgeometryengine.h b/src/core/geometry/qgsinternalgeometryengine.h index 31352d60dab4..46ae8c10ba56 100644 --- a/src/core/geometry/qgsinternalgeometryengine.h +++ b/src/core/geometry/qgsinternalgeometryengine.h @@ -35,7 +35,7 @@ class QgsInternalGeometryEngine * for the whole lifetime of this object. * @param geometry */ - QgsInternalGeometryEngine( const QgsGeometry& geometry ); + explicit QgsInternalGeometryEngine( const QgsGeometry& geometry ); /** * Will extrude a line or (segmentized) curve by a given offset and return a polygon diff --git a/src/core/gps/qextserialport/qextserialport.h b/src/core/gps/qextserialport/qextserialport.h index 14060d7f1678..76d6e95c98fe 100644 --- a/src/core/gps/qextserialport/qextserialport.h +++ b/src/core/gps/qextserialport/qextserialport.h @@ -189,7 +189,7 @@ class QextSerialPort: public QIODevice EventDriven }; - QextSerialPort(QueryMode mode = EventDriven); + explicit QextSerialPort(QueryMode mode = EventDriven); QextSerialPort(const QString & name, QueryMode mode = EventDriven); QextSerialPort(PortSettings const& s, QueryMode mode = EventDriven); QextSerialPort(const QString & name, PortSettings const& s, QueryMode mode = EventDriven); diff --git a/src/core/qgis.h b/src/core/qgis.h index 560880ef1874..130e1bf925e7 100644 --- a/src/core/qgis.h +++ b/src/core/qgis.h @@ -296,7 +296,7 @@ template class QgsSignalBlocker /** Constructor for QgsSignalBlocker * @param object QObject to block signals from */ - QgsSignalBlocker( Object* object ) + explicit QgsSignalBlocker( Object* object ) : mObject( object ) , mPreviousState( object->blockSignals( true ) ) {} diff --git a/src/core/qgsapplication.h b/src/core/qgsapplication.h index 7a2fb04dbcd7..36cc6a123296 100644 --- a/src/core/qgsapplication.h +++ b/src/core/qgsapplication.h @@ -349,6 +349,7 @@ class CORE_EXPORT QgsApplication : public QApplication /** Get maximum concurrent thread count * @note added in 2.4 */ static int maxThreads() { return ABISYM( mMaxThreads ); } + /** Set maximum concurrent thread count * @note must be between 1 and \#cores, -1 means use all available cores * @note added in 2.4 */ diff --git a/src/core/qgsexpressionprivate.h b/src/core/qgsexpressionprivate.h index c91d6ffa7ddc..2692700bc3a7 100644 --- a/src/core/qgsexpressionprivate.h +++ b/src/core/qgsexpressionprivate.h @@ -47,6 +47,7 @@ class QgsExpressionPrivate : ref( 1 ) , mRootNode( other.mRootNode ? other.mRootNode->clone() : nullptr ) , mParserErrorString( other.mParserErrorString ) + , mEvalErrorString( other.mEvalErrorString ) , mRowNumber( 0 ) , mScale( other.mScale ) , mExp( other.mExp ) diff --git a/src/core/qgsexpressionsorter.h b/src/core/qgsexpressionsorter.h index ad40846741aa..52b7e11c0b52 100644 --- a/src/core/qgsexpressionsorter.h +++ b/src/core/qgsexpressionsorter.h @@ -23,7 +23,7 @@ class QgsExpressionSorter { public: - QgsExpressionSorter( const QList& preparedOrderBys ) + explicit QgsExpressionSorter( const QList& preparedOrderBys ) : mPreparedOrderBys( preparedOrderBys ) {} diff --git a/src/core/qgslabelingenginev2.cpp b/src/core/qgslabelingenginev2.cpp index 521c9992dd98..d1111cf1951c 100644 --- a/src/core/qgslabelingenginev2.cpp +++ b/src/core/qgslabelingenginev2.cpp @@ -37,7 +37,7 @@ class QgsLabelSorter { public: - QgsLabelSorter( const QgsMapSettings& mapSettings ) + explicit QgsLabelSorter( const QgsMapSettings& mapSettings ) : mMapSettings( mapSettings ) {} diff --git a/src/core/qgslayerdefinition.cpp b/src/core/qgslayerdefinition.cpp index 14f349a4ee1e..01c2251192b7 100644 --- a/src/core/qgslayerdefinition.cpp +++ b/src/core/qgslayerdefinition.cpp @@ -284,7 +284,7 @@ void QgsLayerDefinition::DependencySorter::init( const QDomDocument& doc ) } else { - it++; + ++it; } } } diff --git a/src/core/qgsnetworkdiskcache.h b/src/core/qgsnetworkdiskcache.h index a385f817ffc9..8c7e52015f8b 100644 --- a/src/core/qgsnetworkdiskcache.h +++ b/src/core/qgsnetworkdiskcache.h @@ -81,13 +81,13 @@ class QgsNetworkDiskCache : public QNetworkDiskCache virtual qint64 expire() override; private: - QgsNetworkDiskCache( QObject *parent ); + explicit QgsNetworkDiskCache( QObject *parent ); Q_DISABLE_COPY( QgsNetworkDiskCache ) class ExpirableNetworkDiskCache : public QNetworkDiskCache { public: - ExpirableNetworkDiskCache( QObject *parent = 0 ) : QNetworkDiskCache( parent ) {} + explicit ExpirableNetworkDiskCache( QObject *parent = 0 ) : QNetworkDiskCache( parent ) {} qint64 runExpire() { return QNetworkDiskCache::expire(); } }; diff --git a/src/core/qgspallabeling.cpp b/src/core/qgspallabeling.cpp index a7bb09f37bbb..d42229b627b4 100644 --- a/src/core/qgspallabeling.cpp +++ b/src/core/qgspallabeling.cpp @@ -4758,7 +4758,7 @@ void QgsPalLabeling::drawLabelBackground( QgsRenderContext& context, // add buffer to greatest dimension of label if ( labelWidth >= labelHeight ) sizeOut = labelWidth; - else if ( labelHeight > labelWidth ) + else sizeOut = labelHeight; // label size in map units, convert to shapeSizeUnits, if different diff --git a/src/core/qgspointlocator.cpp b/src/core/qgspointlocator.cpp index 9b7894f9d35c..3ee2e7508cd9 100644 --- a/src/core/qgspointlocator.cpp +++ b/src/core/qgspointlocator.cpp @@ -30,20 +30,15 @@ using namespace SpatialIndex; static SpatialIndex::Point point2point( const QgsPoint& point ) { - double plow[2]; - plow[0] = point.x(); - plow[1] = point.y(); + double plow[2] = { point.x(), point.y() }; return Point( plow, 2 ); } static SpatialIndex::Region rect2region( const QgsRectangle& rect ) { - double pLow[2], pHigh[2]; - pLow[0] = rect.xMinimum(); - pLow[1] = rect.yMinimum(); - pHigh[0] = rect.xMaximum(); - pHigh[1] = rect.yMaximum(); + double pLow[2] = { rect.xMinimum(), rect.yMinimum() }; + double pHigh[2] = { rect.xMaximum(), rect.yMaximum() }; return SpatialIndex::Region( pLow, pHigh, 2 ); } @@ -357,7 +352,7 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry *geom, co double prevx = 0.0, prevy = 0.0; for ( int index = 0; index < nPoints; ++index ) { - double thisx, thisy; + double thisx = 0.0, thisy = 0.0; wkbPtr >> thisx >> thisy; if ( hasZValue ) wkbPtr += sizeof( double ); @@ -396,7 +391,7 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry *geom, co double prevx = 0.0, prevy = 0.0; for ( int pointnr = 0; pointnr < nPoints; ++pointnr ) { - double thisx, thisy; + double thisx = 0.0, thisy = 0.0; wkbPtr >> thisx >> thisy; if ( hasZValue ) wkbPtr += sizeof( double ); @@ -437,7 +432,7 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry *geom, co double prevx = 0.0, prevy = 0.0; for ( int pointnr = 0; pointnr < nPoints; ++pointnr )//loop over points in a ring { - double thisx, thisy; + double thisx = 0.0, thisy = 0.0; wkbPtr >> thisx >> thisy; if ( hasZValue ) wkbPtr += sizeof( double ); @@ -482,7 +477,7 @@ static QgsPointLocator::MatchList _geometrySegmentsInRect( QgsGeometry *geom, co double prevx = 0.0, prevy = 0.0; for ( int pointnr = 0; pointnr < nPoints; ++pointnr ) { - double thisx, thisy; + double thisx = 0.0, thisy = 0.0; wkbPtr >> thisx >> thisy; if ( hasZValue ) wkbPtr += sizeof( double ); diff --git a/src/core/qgsproject.cpp b/src/core/qgsproject.cpp index 689c7a8b4af8..ad40eccf4044 100644 --- a/src/core/qgsproject.cpp +++ b/src/core/qgsproject.cpp @@ -326,7 +326,7 @@ struct QgsProject::Imp QFile file; // current physical project file QgsPropertyKey properties_; // property hierarchy QString title; // project title - bool autoTransaction; // transaction grouped editing + bool autoTransaction; // transaction grouped editing bool dirty; // project has been modified since it has been read or saved Imp() diff --git a/src/core/qgsprojectproperty.h b/src/core/qgsprojectproperty.h index 2f8a1be998f0..7ee97a80598f 100644 --- a/src/core/qgsprojectproperty.h +++ b/src/core/qgsprojectproperty.h @@ -245,7 +245,6 @@ class CORE_EXPORT QgsPropertyKey : public QgsProperty return setValue( name(), value ); } - void dump( int tabs = 0 ) const override; bool readXML( QDomNode & keyNode ) override; diff --git a/src/core/qgsspatialindex.cpp b/src/core/qgsspatialindex.cpp index 5971f1ca135f..68fd9324644a 100644 --- a/src/core/qgsspatialindex.cpp +++ b/src/core/qgsspatialindex.cpp @@ -244,11 +244,8 @@ QgsSpatialIndex& QgsSpatialIndex::operator=( const QgsSpatialIndex & other ) SpatialIndex::Region QgsSpatialIndex::rectToRegion( const QgsRectangle& rect ) { - double pt1[2], pt2[2]; - pt1[0] = rect.xMinimum(); - pt1[1] = rect.yMinimum(); - pt2[0] = rect.xMaximum(); - pt2[1] = rect.yMaximum(); + double pt1[2] = { rect.xMinimum(), rect.yMinimum() }, + pt2[2] = { rect.xMaximum(), rect.yMaximum() }; return SpatialIndex::Region( pt1, pt2, 2 ); } @@ -324,9 +321,7 @@ QList QgsSpatialIndex::nearestNeighbor( const QgsPoint& point, int QList list; QgisVisitor visitor( list ); - double pt[2]; - pt[0] = point.x(); - pt[1] = point.y(); + double pt[2] = { point.x(), point.y() }; Point p( pt, 2 ); d->mRTree->nearestNeighborQuery( neighbors, p, visitor ); diff --git a/src/core/qgstracer.cpp b/src/core/qgstracer.cpp index bf92286cd8a0..97cd5f5e6242 100644 --- a/src/core/qgstracer.cpp +++ b/src/core/qgstracer.cpp @@ -87,6 +87,8 @@ double closestSegment( const QgsPolyline& pl, const QgsPoint& pt, int& vertexAft /** Simple graph structure for shortest path search */ struct QgsTracerGraph { + QgsTracerGraph() : joinedVertices(0) {} + struct E // bidirectional edge { //! vertices that the edge connects @@ -120,7 +122,7 @@ struct QgsTracerGraph QgsTracerGraph* makeGraph( const QVector& edges ) { - QgsTracerGraph* g = new QgsTracerGraph; + QgsTracerGraph *g = new QgsTracerGraph(); g->joinedVertices = 0; QHash point2vertex; diff --git a/src/core/qgsvectorfilewriter.cpp b/src/core/qgsvectorfilewriter.cpp index 381435624450..46e618cbb898 100644 --- a/src/core/qgsvectorfilewriter.cpp +++ b/src/core/qgsvectorfilewriter.cpp @@ -2516,9 +2516,7 @@ QMap QgsVectorFileWriter::ogrDriverList() // http://lists.osgeo.org/pipermail/gdal-dev/2012-November/034580.html // -> test if creation failes QString option = "SPATIALITE=YES"; - char **options = new char *[2]; - options[0] = CPLStrdup( option.toLocal8Bit().constData() ); - options[1] = nullptr; + char *options[2] = { CPLStrdup( option.toLocal8Bit().constData() ), nullptr }; OGRSFDriverH poDriver; QgsApplication::registerOgrDrivers(); poDriver = OGRGetDriverByName( drvName.toLocal8Bit().constData() ); @@ -2533,7 +2531,6 @@ QMap QgsVectorFileWriter::ogrDriverList() } } CPLFree( options[0] ); - delete [] options; } else if ( drvName == "ESRI Shapefile" ) { diff --git a/src/core/qgsvectorlayer.cpp b/src/core/qgsvectorlayer.cpp index 5eda21993303..b38838b9ad8d 100644 --- a/src/core/qgsvectorlayer.cpp +++ b/src/core/qgsvectorlayer.cpp @@ -706,7 +706,7 @@ class QgsVectorLayerInterruptionCheckerDuringCountSymbolFeatures: public QgsInte public: /** Constructor */ - QgsVectorLayerInterruptionCheckerDuringCountSymbolFeatures( QProgressDialog* dialog ) + explicit QgsVectorLayerInterruptionCheckerDuringCountSymbolFeatures( QProgressDialog* dialog ) : mDialog( dialog ) { } diff --git a/src/core/qgsvectorlayerrenderer.h b/src/core/qgsvectorlayerrenderer.h index 95b13bbd7d99..030b6c787db0 100644 --- a/src/core/qgsvectorlayerrenderer.h +++ b/src/core/qgsvectorlayerrenderer.h @@ -51,7 +51,7 @@ class QgsVectorLayerRendererInterruptionChecker: public QgsInterruptionChecker { public: /** Constructor */ - QgsVectorLayerRendererInterruptionChecker( const QgsRenderContext& context ); + explicit QgsVectorLayerRendererInterruptionChecker( const QgsRenderContext& context ); bool mustStop() const override; private: const QgsRenderContext& mContext; diff --git a/src/gui/qgscodeeditorsql.cpp b/src/gui/qgscodeeditorsql.cpp index 961bf6132567..f9bc48186b43 100644 --- a/src/gui/qgscodeeditorsql.cpp +++ b/src/gui/qgscodeeditorsql.cpp @@ -50,7 +50,7 @@ class QgsCaseInsensitiveLexerSQL: public QsciLexerSQL { public: //! constructor - QgsCaseInsensitiveLexerSQL( QObject *parent = 0 ) : QsciLexerSQL( parent ) {} + explicit QgsCaseInsensitiveLexerSQL( QObject *parent = 0 ) : QsciLexerSQL( parent ) {} bool caseSensitive() const override { return false; } }; diff --git a/src/gui/qgscolorwidgets.cpp b/src/gui/qgscolorwidgets.cpp index c43f51b40bf5..6843740f2e68 100644 --- a/src/gui/qgscolorwidgets.cpp +++ b/src/gui/qgscolorwidgets.cpp @@ -1073,7 +1073,7 @@ void QgsColorRampWidget::paintEvent( QPaintEvent *event ) } } } - else if ( mComponent == QgsColorWidget::Alpha ) + else { //alpha ramps are drawn differently //start with the checkboard pattern diff --git a/src/providers/db2/qgsdb2featureiterator.cpp b/src/providers/db2/qgsdb2featureiterator.cpp index 07f858d0cca5..f4251249b497 100644 --- a/src/providers/db2/qgsdb2featureiterator.cpp +++ b/src/providers/db2/qgsdb2featureiterator.cpp @@ -196,7 +196,6 @@ void QgsDb2FeatureIterator::BuildStatement( const QgsFeatureRequest& request ) mStatement += " WHERE (" + compiler.result() + ')'; else mStatement += " AND (" + compiler.result() + ')'; - filterAdded = true; //if only partial success when compiling expression, we need to double-check results using QGIS' expressions mExpressionCompiled = ( result == QgsSqlExpressionCompiler::Complete ); diff --git a/src/providers/db2/qgsdb2geometrycolumns.cpp b/src/providers/db2/qgsdb2geometrycolumns.cpp index 4a3a734df158..cdb923c695bb 100644 --- a/src/providers/db2/qgsdb2geometrycolumns.cpp +++ b/src/providers/db2/qgsdb2geometrycolumns.cpp @@ -27,12 +27,12 @@ QgsDb2GeometryColumns::QgsDb2GeometryColumns( const QSqlDatabase db ) { QgsDebugMsg( "constructing" ); } + QgsDb2GeometryColumns::~QgsDb2GeometryColumns( ) { mQuery.clear(); } - int QgsDb2GeometryColumns::open() { return open( QString(), QString() ); diff --git a/src/providers/db2/qgsdb2geometrycolumns.h b/src/providers/db2/qgsdb2geometrycolumns.h index c5ce2d223008..21235f118194 100644 --- a/src/providers/db2/qgsdb2geometrycolumns.h +++ b/src/providers/db2/qgsdb2geometrycolumns.h @@ -31,7 +31,7 @@ static const int ENV_LUW = 1, ENV_ZOS = 2; class QgsDb2GeometryColumns { public: - QgsDb2GeometryColumns( const QSqlDatabase db ); + explicit QgsDb2GeometryColumns( const QSqlDatabase db ); ~QgsDb2GeometryColumns(); @@ -50,4 +50,4 @@ class QgsDb2GeometryColumns }; -#endif \ No newline at end of file +#endif diff --git a/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp b/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp index 6af54bf350d6..ab0d2b64d75e 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp @@ -27,6 +27,7 @@ QgsDelimitedTextFeatureIterator::QgsDelimitedTextFeatureIterator( QgsDelimitedTextFeatureSource* source, bool ownSource, const QgsFeatureRequest& request ) : QgsAbstractFeatureIteratorFromSource( source, ownSource, request ) + , mNextId( 0 ) , mTestGeometryExact( false ) { diff --git a/src/providers/gpx/qgsgpxfeatureiterator.cpp b/src/providers/gpx/qgsgpxfeatureiterator.cpp index bd3b82bfad41..0e7aef7983a9 100644 --- a/src/providers/gpx/qgsgpxfeatureiterator.cpp +++ b/src/providers/gpx/qgsgpxfeatureiterator.cpp @@ -27,6 +27,7 @@ QgsGPXFeatureIterator::QgsGPXFeatureIterator( QgsGPXFeatureSource* source, bool ownSource, const QgsFeatureRequest& request ) : QgsAbstractFeatureIteratorFromSource( source, ownSource, request ) + , mFetchedFid( false ) { rewind(); } diff --git a/src/providers/grass/qgis.v.in.cpp b/src/providers/grass/qgis.v.in.cpp index 05123d746748..012bf8dde3a3 100644 --- a/src/providers/grass/qgis.v.in.cpp +++ b/src/providers/grass/qgis.v.in.cpp @@ -326,14 +326,17 @@ int main( int argc, char **argv ) if ( isPolygon ) { - double snapTreshold = 0; G_message( "Building partial topology" ); Vect_build_partial( map, GV_BUILD_BASE ); - if ( snapTreshold > 0 ) +#if 0 + double snapThreshold = 0.0; + if ( snapThreshold > 0.0 ) { - Vect_snap_lines( map, GV_BOUNDARY, snapTreshold, nullptr ); + Vect_snap_lines( map, GV_BOUNDARY, snapThreshold, nullptr ); } +#endif + G_message( "Breaking polygons" ); Vect_break_polygons( map, GV_BOUNDARY, nullptr ); G_message( "Removing duplicates" ); diff --git a/src/providers/mssql/qgsmssqlfeatureiterator.cpp b/src/providers/mssql/qgsmssqlfeatureiterator.cpp index 301856122651..fb484291af9e 100644 --- a/src/providers/mssql/qgsmssqlfeatureiterator.cpp +++ b/src/providers/mssql/qgsmssqlfeatureiterator.cpp @@ -188,7 +188,6 @@ void QgsMssqlFeatureIterator::BuildStatement( const QgsFeatureRequest& request ) mStatement += " WHERE (" + compiler.result() + ')'; else mStatement += " AND (" + compiler.result() + ')'; - filterAdded = true; //if only partial success when compiling expression, we need to double-check results using QGIS' expressions mExpressionCompiled = ( result == QgsSqlExpressionCompiler::Complete ); diff --git a/src/providers/ogr/qgsogrprovider.cpp b/src/providers/ogr/qgsogrprovider.cpp index 3e4343f344ba..7b50fb715cc3 100644 --- a/src/providers/ogr/qgsogrprovider.cpp +++ b/src/providers/ogr/qgsogrprovider.cpp @@ -2137,11 +2137,6 @@ QString createFilters( QString type ) myFileFilters += createFileFilter_( QObject::tr( "Arc/Info Generate" ), "*.gen" ); myExtensions << "gen"; } - else if ( driverName.startsWith( "SXF" ) ) - { - myFileFilters += createFileFilter_( QObject::tr( "Storage and eXchange Format" ), "*.sxf" ); - myExtensions << "sxf"; - } else if ( driverName.startsWith( "PDF" ) ) { myFileFilters += createFileFilter_( QObject::tr( "Geospatial PDF" ), "*.pdf" ); diff --git a/src/providers/virtual/qgsvirtuallayerprovider.h b/src/providers/virtual/qgsvirtuallayerprovider.h index 1b1e030a2821..96bba556475b 100644 --- a/src/providers/virtual/qgsvirtuallayerprovider.h +++ b/src/providers/virtual/qgsvirtuallayerprovider.h @@ -34,7 +34,7 @@ class QgsVirtualLayerProvider: public QgsVectorDataProvider * Constructor of the vector provider * @param uri uniform resource locator (URI) for a dataset */ - QgsVirtualLayerProvider( QString const &uri = "" ); + explicit QgsVirtualLayerProvider( QString const &uri = "" ); /** Destructor */ virtual ~QgsVirtualLayerProvider(); diff --git a/src/providers/virtual/qgsvirtuallayersqlitemodule.cpp b/src/providers/virtual/qgsvirtuallayersqlitemodule.cpp index 092575f8b8b4..3b9676c60e44 100644 --- a/src/providers/virtual/qgsvirtuallayersqlitemodule.cpp +++ b/src/providers/virtual/qgsvirtuallayersqlitemodule.cpp @@ -256,7 +256,7 @@ struct VTableCursor QgsFeatureIterator mIterator; bool mEof; - VTableCursor( VTable *vtab ) + explicit VTableCursor( VTable *vtab ) : mVtab( vtab ) , mEof( true ) {} @@ -874,7 +874,7 @@ void registerQgisFunctions( sqlite3* db ) // is it because a function of the same name already exist (in Spatialite for instance ?) // we then try to recreate it with a prefix name = "qgis_" + name; - r = sqlite3_create_function( db, name.toUtf8().constData(), foo->params(), SQLITE_UTF8, foo, qgisFunctionWrapper, nullptr, nullptr ); + sqlite3_create_function( db, name.toUtf8().constData(), foo->params(), SQLITE_UTF8, foo, qgisFunctionWrapper, nullptr, nullptr ); } } } diff --git a/src/providers/wfs/qgswfsconnection.h b/src/providers/wfs/qgswfsconnection.h index bef87a2497bc..4f294e25743b 100644 --- a/src/providers/wfs/qgswfsconnection.h +++ b/src/providers/wfs/qgswfsconnection.h @@ -25,7 +25,7 @@ class QgsWFSConnection : public QgsOWSConnection * Constructor * @param theConnName connection name */ - QgsWFSConnection( const QString & theConnName ); + explicit QgsWFSConnection( const QString & theConnName ); static QStringList connectionList(); diff --git a/src/providers/wfs/qgswfsdatasourceuri.h b/src/providers/wfs/qgswfsdatasourceuri.h index bed0d199c6a0..d995b1ca80fa 100644 --- a/src/providers/wfs/qgswfsdatasourceuri.h +++ b/src/providers/wfs/qgswfsdatasourceuri.h @@ -63,7 +63,7 @@ class QgsWFSDataSourceURI { public: - QgsWFSDataSourceURI( const QString& uri ); + explicit QgsWFSDataSourceURI( const QString& uri ); /** Return the URI */ QString uri(); diff --git a/src/providers/wfs/qgswfsprovider.cpp b/src/providers/wfs/qgswfsprovider.cpp index 3b00745df710..b46d57f7be55 100644 --- a/src/providers/wfs/qgswfsprovider.cpp +++ b/src/providers/wfs/qgswfsprovider.cpp @@ -50,7 +50,7 @@ static const QString TEXT_PROVIDER_KEY = "WFS"; static const QString TEXT_PROVIDER_DESCRIPTION = "WFS data provider"; -QgsWFSProvider::QgsWFSProvider( const QString& uri, const QgsWFSCapabilities::Capabilities caps ) +QgsWFSProvider::QgsWFSProvider( const QString& uri, const QgsWFSCapabilities::Capabilities &caps ) : QgsVectorDataProvider( uri ) , mShared( new QgsWFSSharedData( uri ) ) , mWKBType( QGis::WKBUnknown ) diff --git a/src/providers/wfs/qgswfsprovider.h b/src/providers/wfs/qgswfsprovider.h index cc4f6a1d9fc2..e4f6e486c890 100644 --- a/src/providers/wfs/qgswfsprovider.h +++ b/src/providers/wfs/qgswfsprovider.h @@ -62,7 +62,7 @@ class QgsWFSProvider : public QgsVectorDataProvider Q_OBJECT public: - explicit QgsWFSProvider( const QString& uri, const QgsWFSCapabilities::Capabilities caps = QgsWFSCapabilities::Capabilities() ); + explicit QgsWFSProvider( const QString& uri, const QgsWFSCapabilities::Capabilities &caps = QgsWFSCapabilities::Capabilities() ); ~QgsWFSProvider(); /* Inherited from QgsVectorDataProvider */ diff --git a/src/providers/wfs/qgswfsrequest.cpp b/src/providers/wfs/qgswfsrequest.cpp index 4fd19a20180a..2e7d98594b31 100644 --- a/src/providers/wfs/qgswfsrequest.cpp +++ b/src/providers/wfs/qgswfsrequest.cpp @@ -66,7 +66,7 @@ bool QgsWFSRequest::sendGET( const QUrl& url, bool synchronous, bool forceRefres // Just for testing with local files instead of http:// ressources QString modifiedUrlString = modifiedUrl.toString(); // Qt5 does URL encoding from some reason (of the FILTER parameter for example) - modifiedUrlString = QUrl::fromPercentEncoding( modifiedUrl.toString().toUtf8() ); + modifiedUrlString = QUrl::fromPercentEncoding( modifiedUrlString.toUtf8() ); QgsDebugMsg( QString( "Get %1" ).arg( modifiedUrlString ) ); modifiedUrlString = modifiedUrlString.mid( QString( "http://" ).size() ); QString args = modifiedUrlString.mid( modifiedUrlString.indexOf( '?' ) ); diff --git a/src/providers/wfs/qgswfsshareddata.cpp b/src/providers/wfs/qgswfsshareddata.cpp index 692f8d14b8eb..5a840218feb3 100644 --- a/src/providers/wfs/qgswfsshareddata.cpp +++ b/src/providers/wfs/qgswfsshareddata.cpp @@ -233,7 +233,7 @@ bool QgsWFSSharedData::createCache() if ( mDistinctSelect ) cacheFields.append( QgsField( QgsWFSConstants::FIELD_MD5, QVariant::String, "string" ) ); - bool ogrWaySuccessfull = false; + bool ogrWaySuccessful = false; QString geometryFieldname( "__spatialite_geometry" ); #ifdef USE_OGR_FOR_DB_CREATION // Only GDAL >= 2.0 can use an alternate geometry field name @@ -282,7 +282,7 @@ bool QgsWFSSharedData::createCache() return false; } - ogrWaySuccessfull = true; + ogrWaySuccessful = true; } else { @@ -295,7 +295,7 @@ bool QgsWFSSharedData::createCache() } } #endif - if ( !ogrWaySuccessfull ) + if ( !ogrWaySuccessful ) { static QMutex mutexDBnameCreation; static QByteArray cachedDBTemplate; @@ -365,7 +365,7 @@ bool QgsWFSSharedData::createCache() ( void )sqlite3_exec( db, "BEGIN", nullptr, nullptr, nullptr ); - if ( !ogrWaySuccessfull ) + if ( !ogrWaySuccessful ) { mCacheTablename = "features"; sql = QString( "CREATE TABLE %1 (ogc_fid INTEGER PRIMARY KEY" ).arg( mCacheTablename ); diff --git a/tests/src/core/testqgsconnectionpool.cpp b/tests/src/core/testqgsconnectionpool.cpp index a350997a4ef3..b29dc9e0710a 100644 --- a/tests/src/core/testqgsconnectionpool.cpp +++ b/tests/src/core/testqgsconnectionpool.cpp @@ -37,7 +37,7 @@ class TestQgsConnectionPool: public QObject private: struct ReadJob { - ReadJob( QgsVectorLayer* _layer ) : layer( _layer ) {} + explicit ReadJob( QgsVectorLayer* _layer ) : layer( _layer ) {} QgsVectorLayer* layer; QList features; }; diff --git a/tests/src/core/testqgsfields.cpp b/tests/src/core/testqgsfields.cpp index 497f564db81b..e205ede76ad2 100644 --- a/tests/src/core/testqgsfields.cpp +++ b/tests/src/core/testqgsfields.cpp @@ -521,7 +521,7 @@ void TestQgsFields::iterator() QgsFields::iterator it2( it ); QVERIFY( it <= it2 ); QVERIFY( it2 >= it ); - it2++; + ++it2; QVERIFY( it < it2 ); QVERIFY( it <= it2 ); QVERIFY( it2 > it ); @@ -582,7 +582,7 @@ void TestQgsFields::constIterator() QgsFields::const_iterator it3( it ); QVERIFY( it <= it3 ); QVERIFY( it3 >= it ); - it3++; + ++it3; QVERIFY( it < it3 ); QVERIFY( it <= it3 ); QVERIFY( it3 > it ); diff --git a/tests/src/providers/grass/testqgsgrassprovider.cpp b/tests/src/providers/grass/testqgsgrassprovider.cpp index 5d287b28d9e0..ae0e6afc0da4 100644 --- a/tests/src/providers/grass/testqgsgrassprovider.cpp +++ b/tests/src/providers/grass/testqgsgrassprovider.cpp @@ -53,7 +53,7 @@ class TestQgsGrassFeature : public QgsFeature { public: TestQgsGrassFeature() : grassType( 0 ) { setValid( true ); } - TestQgsGrassFeature( int type ) : grassType( type ) { setValid( true ); } + explicit TestQgsGrassFeature( int type ) : grassType( type ) { setValid( true ); } int grassType; }; @@ -84,7 +84,7 @@ class TestQgsGrassCommand , fid( 0 ) , geometry( 0 ) {} - TestQgsGrassCommand( Command c ) + explicit TestQgsGrassCommand( Command c ) : command( c ) , verify( true ) , fid( 0 )