Fix set but unused variables

This commit is contained in:
Julien Cabieces 2023-03-29 16:48:44 +02:00 committed by Nyall Dawson
parent 9233530050
commit d0238805ea
21 changed files with 22 additions and 51 deletions

View File

@ -317,8 +317,6 @@ Delaunator::Delaunator(std::vector<double> 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<double> 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<double> 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<double> const& in_coords)
legalize(t + 2);
hull_tri[q] = t;
hull_next[e] = e; // mark as removed
hull_size--;
e = q;
}
}

View File

@ -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 );

View File

@ -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;

View File

@ -208,10 +208,12 @@ QVector<QgsRayCastingUtils::RayHit> 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<QgsRayCastingUtils::RayHit> result;
float minDist = -1;
@ -220,12 +222,16 @@ QVector<QgsRayCastingUtils::RayHit> 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<Qt3DRender::QGeometryRenderer *> rendLst = node->entity()->findChildren<Qt3DRender::QGeometryRenderer *>();
for ( const auto &rend : rendLst )
{
@ -233,7 +239,9 @@ QVector<QgsRayCastingUtils::RayHit> QgsVectorLayerChunkedEntity::rayIntersection
QgsTessellatedPolygonGeometry *polygonGeom = qobject_cast<QgsTessellatedPolygonGeometry *>( geom );
if ( !polygonGeom )
{
#ifdef QGISDEBUG
ignoredGeometries++;
#endif
continue; // other QGeometry types are not supported for now
}
@ -241,7 +249,9 @@ QVector<QgsRayCastingUtils::RayHit> 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 )
{

View File

@ -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;

View File

@ -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;

View File

@ -90,14 +90,12 @@ static void buildSnapIndex( QgsFeatureIterator &fi, QgsSpatialIndex &index, QVec
static void assignAnchors( QgsSpatialIndex &index, QVector<AnchorPoint> &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<AnchorPoint> &pnts, d
{
// doesn't have an anchor yet
pnts[pointb].anchor = point;
ntosnap++;
}
else if ( pnts[pointb].anchor >= 0 )
{

View File

@ -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<QgsBookmark> matching = manager->bookmarksByGroup( g );
@ -1194,7 +1193,6 @@ void QgsBookmarksItemGuiProvider::populateContextMenu( QgsDataItem *item, QMenu
{
manager->removeBookmark( bookmark.id() );
}
i++;
}
}
} );

View File

@ -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 );

View File

@ -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<QgsAuthCertUtils::CaCertSource, QSslCertificate>( source, cert ) );
}
}

View File

@ -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<QgsLayoutItem *> droppedItems;
int rows = 0;
while ( !stream.atEnd() )
{
@ -343,7 +342,6 @@ bool QgsLayoutModel::dropMimeData( const QMimeData *data,
if ( item )
{
droppedItems << item;
++rows;
}
}

View File

@ -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];

View File

@ -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;

View File

@ -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();

View File

@ -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++;
}
}
}

View File

@ -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

View File

@ -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;
}

View File

@ -728,10 +728,8 @@ void QgsOracleConn::retrieveLayerTypes( QgsOracleLayerProperty &layerProperty, b
layerProperty.srids.clear();
QSet<int> srids;
long long fetchedRows { 0 };
while ( qry.next() )
{
fetchedRows++;
if ( detectedType == Qgis::WkbType::Unknown )
{
Qgis::WkbType type = wkbTypeFromDatabase( qry.value( 0 ).toInt() );

View File

@ -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" )

View File

@ -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++;

View File

@ -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 );