diff --git a/external/delaunator-cpp/delaunator.hpp b/external/delaunator-cpp/delaunator.hpp index 6bc5221a914..44105d83efc 100644 --- a/external/delaunator-cpp/delaunator.hpp +++ b/external/delaunator-cpp/delaunator.hpp @@ -317,8 +317,6 @@ Delaunator::Delaunator(std::vector const& in_coords) hull_start = i0; - size_t hull_size = 3; - hull_next[i0] = hull_prev[i2] = i1; hull_next[i1] = hull_prev[i0] = i2; hull_next[i2] = hull_prev[i1] = i0; @@ -387,7 +385,6 @@ Delaunator::Delaunator(std::vector const& in_coords) hull_tri[i] = legalize(t + 2); hull_tri[e] = t; - hull_size++; // walk forward through the hull, adding more triangles and flipping recursively std::size_t next = hull_next[e]; @@ -397,7 +394,6 @@ Delaunator::Delaunator(std::vector const& in_coords) t = add_triangle(next, i, q, hull_tri[i], INVALID_INDEX, hull_tri[next]); hull_tri[i] = legalize(t + 2); hull_next[next] = next; // mark as removed - hull_size--; next = q; } @@ -410,7 +406,6 @@ Delaunator::Delaunator(std::vector const& in_coords) legalize(t + 2); hull_tri[q] = t; hull_next[e] = e; // mark as removed - hull_size--; e = q; } } diff --git a/external/mdal/frmts/mdal_flo2d.cpp b/external/mdal/frmts/mdal_flo2d.cpp index 58cc0371c02..e03e218220c 100644 --- a/external/mdal/frmts/mdal_flo2d.cpp +++ b/external/mdal/frmts/mdal_flo2d.cpp @@ -554,7 +554,6 @@ void MDAL::DriverFlo2D::parseTIMDEPFile( const std::string &datFileName, const s std::string line; size_t nVertexs = mMesh->verticesCount(); - size_t ntimes = 0; RelativeTimestamp time = RelativeTimestamp(); size_t face_idx = 0; @@ -598,7 +597,6 @@ void MDAL::DriverFlo2D::parseTIMDEPFile( const std::string &datFileName, const s if ( lineParts.size() == 1 ) { time = RelativeTimestamp( MDAL::toDouble( line ), RelativeTimestamp::hours ); - ntimes++; if ( depthDataset ) addDatasetToGroup( depthDsGroup, depthDataset ); if ( flowDataset ) addDatasetToGroup( flowDsGroup, flowDataset ); diff --git a/external/mdal/frmts/mdal_gdal.cpp b/external/mdal/frmts/mdal_gdal.cpp index 2933271fbc9..7686863bf12 100644 --- a/external/mdal/frmts/mdal_gdal.cpp +++ b/external/mdal/frmts/mdal_gdal.cpp @@ -114,6 +114,7 @@ bool MDAL::DriverGdal::initVertices( Vertices &vertices ) void MDAL::DriverGdal::initFaces( const Vertices &Vertexs, Faces &Faces, bool is_longitude_shifted ) { int reconnected = 0; + ( void ) reconnected; unsigned int mXSize = meshGDALDataset()->mXSize; unsigned int mYSize = meshGDALDataset()->mYSize; diff --git a/src/3d/qgsvectorlayerchunkloader_p.cpp b/src/3d/qgsvectorlayerchunkloader_p.cpp index 55b0ff503f6..3e826917384 100644 --- a/src/3d/qgsvectorlayerchunkloader_p.cpp +++ b/src/3d/qgsvectorlayerchunkloader_p.cpp @@ -208,10 +208,12 @@ QVector QgsVectorLayerChunkedEntity::rayIntersection { Q_UNUSED( context ) QgsDebugMsgLevel( QStringLiteral( "Ray cast on vector layer" ), 2 ); +#ifdef QGISDEBUG int nodeUsed = 0; int nodesAll = 0; int hits = 0; int ignoredGeometries = 0; +#endif QVector result; float minDist = -1; @@ -220,12 +222,16 @@ QVector QgsVectorLayerChunkedEntity::rayIntersection for ( QgsChunkNode *node : activeNodes ) { +#ifdef QGISDEBUG nodesAll++; +#endif if ( node->entity() && ( minDist < 0 || node->bbox().distanceFromPoint( ray.origin() ) < minDist ) && QgsRayCastingUtils::rayBoxIntersection( ray, node->bbox() ) ) { +#ifdef QGISDEBUG nodeUsed++; +#endif const QList rendLst = node->entity()->findChildren(); for ( const auto &rend : rendLst ) { @@ -233,7 +239,9 @@ QVector QgsVectorLayerChunkedEntity::rayIntersection QgsTessellatedPolygonGeometry *polygonGeom = qobject_cast( geom ); if ( !polygonGeom ) { +#ifdef QGISDEBUG ignoredGeometries++; +#endif continue; // other QGeometry types are not supported for now } @@ -241,7 +249,9 @@ QVector QgsVectorLayerChunkedEntity::rayIntersection QgsFeatureId fid = FID_NULL; if ( polygonGeom->rayIntersection( ray, transformMatrix, nodeIntPoint, fid ) ) { +#ifdef QGISDEBUG hits++; +#endif float dist = ( ray.origin() - nodeIntPoint ).length(); if ( minDist < 0 || dist < minDist ) { diff --git a/src/analysis/processing/qgsalgorithmrandompointsinpolygons.cpp b/src/analysis/processing/qgsalgorithmrandompointsinpolygons.cpp index 922d5068b49..f660eb19ab0 100644 --- a/src/analysis/processing/qgsalgorithmrandompointsinpolygons.cpp +++ b/src/analysis/processing/qgsalgorithmrandompointsinpolygons.cpp @@ -212,7 +212,6 @@ QVariantMap QgsRandomPointsInPolygonsAlgorithm::processAlgorithm( const QVariant int missedPolygons = 0; int emptyOrNullGeom = 0; - long featureCount = 0; long long attempts = 0; // used for unique feature IDs in the indexes const long numberOfFeatures = polygonSource->featureCount(); long long desiredNumberOfPoints = 0; @@ -232,7 +231,6 @@ QVariantMap QgsRandomPointsInPolygonsAlgorithm::processAlgorithm( const QVariant { // Increment invalid features count emptyOrNullGeom++; - featureCount++; baseFeatureProgress += featureProgressStep; feedback->setProgress( baseFeatureProgress ); continue; @@ -242,7 +240,6 @@ QVariantMap QgsRandomPointsInPolygonsAlgorithm::processAlgorithm( const QVariant { // Increment invalid features count emptyOrNullGeom++; - featureCount++; baseFeatureProgress += featureProgressStep; feedback->setProgress( baseFeatureProgress ); continue; @@ -376,7 +373,6 @@ QVariantMap QgsRandomPointsInPolygonsAlgorithm::processAlgorithm( const QVariant { missedPolygons++; } - featureCount++; feedback->setProgress( baseFeatureProgress ); } // while features missedPoints = desiredNumberOfPoints - totNPoints; diff --git a/src/analysis/processing/qgsalgorithmrandompointsonlines.cpp b/src/analysis/processing/qgsalgorithmrandompointsonlines.cpp index 559ef6d88ad..03ea931eace 100644 --- a/src/analysis/processing/qgsalgorithmrandompointsonlines.cpp +++ b/src/analysis/processing/qgsalgorithmrandompointsonlines.cpp @@ -217,7 +217,6 @@ QVariantMap QgsRandomPointsOnLinesAlgorithm::processAlgorithm( const QVariantMap int missedLines = 0; int emptyOrNullGeom = 0; - long featureCount = 0; const long numberOfFeatures = lineSource->featureCount(); long long desiredNumberOfPoints = 0; const double featureProgressStep = 100.0 / ( numberOfFeatures > 0 ? numberOfFeatures : 1 ); @@ -236,7 +235,6 @@ QVariantMap QgsRandomPointsOnLinesAlgorithm::processAlgorithm( const QVariantMap { // Increment invalid features count emptyOrNullGeom++; - featureCount++; baseFeatureProgress += featureProgressStep; feedback->setProgress( baseFeatureProgress ); continue; @@ -246,7 +244,6 @@ QVariantMap QgsRandomPointsOnLinesAlgorithm::processAlgorithm( const QVariantMap { // Increment invalid features count emptyOrNullGeom++; - featureCount++; baseFeatureProgress += featureProgressStep; feedback->setProgress( baseFeatureProgress ); continue; @@ -364,7 +361,6 @@ QVariantMap QgsRandomPointsOnLinesAlgorithm::processAlgorithm( const QVariantMap { missedLines++; } - featureCount++; feedback->setProgress( baseFeatureProgress ); } // while features missedPoints = desiredNumberOfPoints - totNPoints; diff --git a/src/analysis/vector/qgsgeometrysnappersinglesource.cpp b/src/analysis/vector/qgsgeometrysnappersinglesource.cpp index 28194636cef..a1b3ca8190b 100644 --- a/src/analysis/vector/qgsgeometrysnappersinglesource.cpp +++ b/src/analysis/vector/qgsgeometrysnappersinglesource.cpp @@ -90,14 +90,12 @@ static void buildSnapIndex( QgsFeatureIterator &fi, QgsSpatialIndex &index, QVec static void assignAnchors( QgsSpatialIndex &index, QVector &pnts, double thresh ) { const double thresh2 = thresh * thresh; - int nanchors = 0, ntosnap = 0; for ( int point = 0; point < pnts.count(); ++point ) { if ( pnts[point].anchor >= 0 ) continue; pnts[point].anchor = -2; // make it anchor - nanchors++; // Find points in threshold double x = pnts[point].x, y = pnts[point].y; @@ -119,7 +117,6 @@ static void assignAnchors( QgsSpatialIndex &index, QVector &pnts, d { // doesn't have an anchor yet pnts[pointb].anchor = point; - ntosnap++; } else if ( pnts[pointb].anchor >= 0 ) { diff --git a/src/app/qgsappbrowserproviders.cpp b/src/app/qgsappbrowserproviders.cpp index 27af5c7bcde..bb70cd76548 100644 --- a/src/app/qgsappbrowserproviders.cpp +++ b/src/app/qgsappbrowserproviders.cpp @@ -1186,7 +1186,6 @@ void QgsBookmarksItemGuiProvider::populateContextMenu( QgsDataItem *item, QMenu QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) != QMessageBox::Yes ) return; - int i = 0; for ( const QString &g : groups ) { const QList matching = manager->bookmarksByGroup( g ); @@ -1194,7 +1193,6 @@ void QgsBookmarksItemGuiProvider::populateContextMenu( QgsDataItem *item, QMenu { manager->removeBookmark( bookmark.id() ); } - i++; } } } ); diff --git a/src/app/qgsidentifyresultsdialog.cpp b/src/app/qgsidentifyresultsdialog.cpp index 684dacd9757..053985d16ac 100644 --- a/src/app/qgsidentifyresultsdialog.cpp +++ b/src/app/qgsidentifyresultsdialog.cpp @@ -1669,12 +1669,11 @@ void QgsIdentifyResultsDialog::clear() void QgsIdentifyResultsDialog::updateViewModes() { // get # of identified vector and raster layers - there must be a better way involving caching - int vectorCount = 0, rasterCount = 0; + int rasterCount = 0; for ( int i = 0; i < lstResults->topLevelItemCount(); i++ ) { QTreeWidgetItem *item = lstResults->topLevelItem( i ); - if ( vectorLayer( item ) ) vectorCount++; - else if ( rasterLayer( item ) ) rasterCount++; + if ( rasterLayer( item ) ) rasterCount++; } lblViewMode->setEnabled( rasterCount > 0 ); diff --git a/src/core/auth/qgsauthmanager.cpp b/src/core/auth/qgsauthmanager.cpp index fc860e7a112..5da1f73c694 100644 --- a/src/core/auth/qgsauthmanager.cpp +++ b/src/core/auth/qgsauthmanager.cpp @@ -3575,10 +3575,15 @@ bool QgsAuthManager::verifyPasswordCanDecryptConfigs() const return false; } +#ifdef QGISDEBUG int checked = 0; +#endif + while ( query.next() ) { +#ifdef QGISDEBUG ++checked; +#endif QString configstring( QgsAuthCrypto::decrypt( mMasterPass, masterPasswordCiv(), query.value( 1 ).toString() ) ); if ( configstring.isEmpty() ) { @@ -3948,4 +3953,3 @@ void QgsAuthManager::insertCaCertInCache( QgsAuthCertUtils::CaCertSource source, QPair( source, cert ) ); } } - diff --git a/src/core/layout/qgslayoutmodel.cpp b/src/core/layout/qgslayoutmodel.cpp index 188fa7ff2c8..99cf2f2722b 100644 --- a/src/core/layout/qgslayoutmodel.cpp +++ b/src/core/layout/qgslayoutmodel.cpp @@ -333,7 +333,6 @@ bool QgsLayoutModel::dropMimeData( const QMimeData *data, QByteArray encodedData = data->data( QStringLiteral( "application/x-vnd.qgis.qgis.composeritemid" ) ); QDataStream stream( &encodedData, QIODevice::ReadOnly ); QList droppedItems; - int rows = 0; while ( !stream.atEnd() ) { @@ -343,7 +342,6 @@ bool QgsLayoutModel::dropMimeData( const QMimeData *data, if ( item ) { droppedItems << item; - ++rows; } } diff --git a/src/core/pal/feature.cpp b/src/core/pal/feature.cpp index 84270867c21..791ff853903 100644 --- a/src/core/pal/feature.cpp +++ b/src/core/pal/feature.cpp @@ -905,7 +905,6 @@ std::size_t FeaturePart::createCandidatesAlongLineNearStraightSegments( std::vec straightSegmentAngles.reserve( extremeAngleNodes.size() + 1 ); double currentStraightSegmentLength = 0; double longestSegmentLength = 0; - int segmentIndex = 0; double segmentStartX = x[0]; double segmentStartY = y[0]; for ( int i = 0; i < numberNodes - 1; i++ ) @@ -923,7 +922,6 @@ std::size_t FeaturePart::createCandidatesAlongLineNearStraightSegments( std::vec straightSegmentLengths << currentStraightSegmentLength; straightSegmentAngles << QgsGeometryUtils::normalizedAngle( std::atan2( y[i] - segmentStartY, x[i] - segmentStartX ) ); longestSegmentLength = std::max( longestSegmentLength, currentStraightSegmentLength ); - segmentIndex++; currentStraightSegmentLength = 0; segmentStartX = x[i]; segmentStartY = y[i]; diff --git a/src/core/pal/problem.cpp b/src/core/pal/problem.cpp index b10be3e1f80..55df4fdcb09 100644 --- a/src/core/pal/problem.cpp +++ b/src/core/pal/problem.cpp @@ -585,7 +585,6 @@ void Problem::chainSearch( QgsRenderContext & ) bool *ok = new bool[mFeatureCount]; int fid; int lid; - int popit = 0; Chain *retainedChain = nullptr; @@ -655,7 +654,6 @@ void Problem::chainSearch( QgsRenderContext & ) } delete_chain( retainedChain ); - popit++; } delete[] ok; diff --git a/src/core/pointcloud/qgspointcloudlayerexporter.cpp b/src/core/pointcloud/qgspointcloudlayerexporter.cpp index 65e40c02831..9819f818b21 100644 --- a/src/core/pointcloud/qgspointcloudlayerexporter.cpp +++ b/src/core/pointcloud/qgspointcloudlayerexporter.cpp @@ -350,7 +350,6 @@ void QgsPointCloudLayerExporter::ExporterBase::run() } } - int pointsSkipped = 0; const qint64 pointsToExport = mParent->mPointsLimit > 0 ? std::min( mParent->mPointsLimit, pointCount ) : pointCount; QgsPointCloudRequest request; request.setAttributes( mParent->requestedAttributeCollection() ); @@ -397,7 +396,6 @@ void QgsPointCloudLayerExporter::ExporterBase::run() ! mParent->mExtent.contains( x, y ) || ( mParent->mFilterGeometryEngine && ! mParent->mFilterGeometryEngine->contains( x, y ) ) ) { - ++pointsSkipped; continue; } @@ -411,7 +409,6 @@ void QgsPointCloudLayerExporter::ExporterBase::run() catch ( const QgsCsException &cse ) { QgsDebugMsg( QStringLiteral( "Error transforming point: %1" ).arg( cse.what() ) ); - ++pointsSkipped; } } handleNode(); diff --git a/src/core/qgsjsonutils.cpp b/src/core/qgsjsonutils.cpp index 34f36a8e27c..7c29b2f9ecd 100644 --- a/src/core/qgsjsonutils.cpp +++ b/src/core/qgsjsonutils.cpp @@ -144,7 +144,6 @@ json QgsJsonExporter::exportFeatureToJsonObject( const QgsFeature &feature, cons } // build up properties element - int attributeCounter { 0 }; json properties; if ( mIncludeAttributes || !extraProperties.isEmpty() ) { @@ -180,7 +179,6 @@ json QgsJsonExporter::exportFeatureToJsonObject( const QgsFeature &feature, cons name = mLayer->attributeDisplayName( i ); } properties[ name.toStdString() ] = QgsJsonUtils::jsonFromVariant( val ); - attributeCounter++; } } @@ -190,7 +188,6 @@ json QgsJsonExporter::exportFeatureToJsonObject( const QgsFeature &feature, cons for ( ; it != extraProperties.constEnd(); ++it ) { properties[ it.key().toStdString() ] = QgsJsonUtils::jsonFromVariant( it.value() ); - attributeCounter++; } } @@ -224,7 +221,6 @@ json QgsJsonExporter::exportFeatureToJsonObject( const QgsFeature &feature, cons } } properties[ relation.name().toStdString() ] = relatedFeatureAttributes; - attributeCounter++; } } } diff --git a/src/core/symbology/qgslinesymbollayer.cpp b/src/core/symbology/qgslinesymbollayer.cpp index 87ac36aa87e..2820fd7958e 100644 --- a/src/core/symbology/qgslinesymbollayer.cpp +++ b/src/core/symbology/qgslinesymbollayer.cpp @@ -2353,7 +2353,6 @@ void QgsTemplatedLineSymbolLayerBase::renderPolylineCentral( const QPolygonF &po last = *it; qreal last_at = 0, next_at = 0; QPointF next; - int segment = 0; for ( ++it; it != points.constEnd(); ++it ) { next = *it; @@ -2363,7 +2362,6 @@ void QgsTemplatedLineSymbolLayerBase::renderPolylineCentral( const QPolygonF &po break; // we have reached the center last = *it; last_at = next_at; - segment++; } // find out the central point on segment diff --git a/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp b/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp index b8097e9605a..fd3d8793814 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp @@ -425,7 +425,6 @@ void QgsDelimitedTextProvider::scanFile( bool buildIndexes, bool forceFullScan, // Also build subset and spatial indexes. QStringList parts; - long nEmptyRecords = 0; long nBadFormatRecords = 0; long nIncompatibleGeometry = 0; long nInvalidGeometry = 0; @@ -464,7 +463,6 @@ void QgsDelimitedTextProvider::scanFile( bool buildIndexes, bool forceFullScan, // Skip over empty records if ( recordIsEmpty( parts ) ) { - nEmptyRecords++; continue; } diff --git a/src/providers/oracle/qgsoracleconn.cpp b/src/providers/oracle/qgsoracleconn.cpp index a8155ce0176..8a0b709a813 100644 --- a/src/providers/oracle/qgsoracleconn.cpp +++ b/src/providers/oracle/qgsoracleconn.cpp @@ -728,10 +728,8 @@ void QgsOracleConn::retrieveLayerTypes( QgsOracleLayerProperty &layerProperty, b layerProperty.srids.clear(); QSet srids; - long long fetchedRows { 0 }; while ( qry.next() ) { - fetchedRows++; if ( detectedType == Qgis::WkbType::Unknown ) { Qgis::WkbType type = wkbTypeFromDatabase( qry.value( 0 ).toInt() ); diff --git a/src/providers/oracle/qgsoracleprovider.cpp b/src/providers/oracle/qgsoracleprovider.cpp index d93d6172730..88aeaacd23a 100644 --- a/src/providers/oracle/qgsoracleprovider.cpp +++ b/src/providers/oracle/qgsoracleprovider.cpp @@ -663,10 +663,8 @@ bool QgsOracleProvider::loadFields() if ( LoggedExecStatic( qry, sql, args, mUri.uri() ) ) { - long long fetchedRows { 0 }; while ( qry.next() ) { - fetchedRows++; QString name = qry.value( 0 ).toString(); QString type = qry.value( 1 ).toString(); int prec = qry.value( 2 ).toInt(); @@ -825,10 +823,8 @@ bool QgsOracleProvider::hasSufficientPermsAndCapabilities() QVariantList() << mOwnerName << mTableName, mUri.uri() ) ) { // check grants - long long fetchedRows { 0 }; while ( qry.next() ) { - fetchedRows++; QString priv = qry.value( 0 ).toString(); if ( priv == "DELETE" ) diff --git a/src/providers/postgres/qgspostgresconn.cpp b/src/providers/postgres/qgspostgresconn.cpp index 2b8e6caab71..c6a9c5559d0 100644 --- a/src/providers/postgres/qgspostgresconn.cpp +++ b/src/providers/postgres/qgspostgresconn.cpp @@ -1949,7 +1949,9 @@ void QgsPostgresConn::deduceEndian() // return data in the endian of the server QgsPostgresResult resOID; +#ifdef QGISDEBUG int queryCounter = 0; +#endif int errorCounter = 0; int oidStatus = 0; int oidSelectSet = 1 << 0; @@ -1974,7 +1976,9 @@ void QgsPostgresConn::deduceEndian() if ( resOID.result() == nullptr ) break; +#ifdef QGISDEBUG queryCounter++; +#endif if ( resOID.PQresultStatus() == PGRES_FATAL_ERROR ) { errorCounter++; diff --git a/tests/src/core/testqgsdxfexport.cpp b/tests/src/core/testqgsdxfexport.cpp index f66e9a0618e..a4ac5a66bb3 100644 --- a/tests/src/core/testqgsdxfexport.cpp +++ b/tests/src/core/testqgsdxfexport.cpp @@ -641,8 +641,6 @@ void TestQgsDxfExport::testTextAlign() d.setFlags( QgsDxfExport::FlagNoMText ); d.setExtent( mapSettings.extent() ); - static int testNumber = 0; - ++testNumber; const QString file = getTempFileName( QStringLiteral( "text_dxf_%1_%2" ).arg( hali, vali ) ); QFile dxfFile( file ); QCOMPARE( d.writeToFile( &dxfFile, QStringLiteral( "CP1252" ) ), QgsDxfExport::ExportResult::Success ); @@ -784,8 +782,6 @@ void TestQgsDxfExport::testTextQuadrant() d.setFlags( QgsDxfExport::FlagNoMText ); d.setExtent( mapSettings.extent() ); - static int testNumber = 0; - ++testNumber; const QString file = getTempFileName( QStringLiteral( "text_dxf_offset_quad_%1_%2" ).arg( offsetQuad ).arg( angle ) ); QFile dxfFile( file ); QCOMPARE( d.writeToFile( &dxfFile, QStringLiteral( "CP1252" ) ), QgsDxfExport::ExportResult::Success );