Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix set but unused variables
  • Loading branch information
troopa81 authored and nyalldawson committed Apr 11, 2023
1 parent 9233530 commit d023880
Show file tree
Hide file tree
Showing 21 changed files with 22 additions and 51 deletions.
5 changes: 0 additions & 5 deletions external/delaunator-cpp/delaunator.hpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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];
Expand All @@ -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;
}

Expand All @@ -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;
}
}
Expand Down
2 changes: 0 additions & 2 deletions external/mdal/frmts/mdal_flo2d.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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 );
Expand Down
1 change: 1 addition & 0 deletions external/mdal/frmts/mdal_gdal.cpp
Expand Up @@ -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;

Expand Down
10 changes: 10 additions & 0 deletions src/3d/qgsvectorlayerchunkloader_p.cpp
Expand Up @@ -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;
Expand All @@ -220,28 +222,36 @@ 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 )
{
auto *geom = rend->geometry();
QgsTessellatedPolygonGeometry *polygonGeom = qobject_cast<QgsTessellatedPolygonGeometry *>( geom );
if ( !polygonGeom )
{
#ifdef QGISDEBUG
ignoredGeometries++;
#endif
continue; // other QGeometry types are not supported for now
}

QVector3D nodeIntPoint;
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 )
{
Expand Down
Expand Up @@ -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;
Expand All @@ -232,7 +231,6 @@ QVariantMap QgsRandomPointsInPolygonsAlgorithm::processAlgorithm( const QVariant
{
// Increment invalid features count
emptyOrNullGeom++;
featureCount++;
baseFeatureProgress += featureProgressStep;
feedback->setProgress( baseFeatureProgress );
continue;
Expand All @@ -242,7 +240,6 @@ QVariantMap QgsRandomPointsInPolygonsAlgorithm::processAlgorithm( const QVariant
{
// Increment invalid features count
emptyOrNullGeom++;
featureCount++;
baseFeatureProgress += featureProgressStep;
feedback->setProgress( baseFeatureProgress );
continue;
Expand Down Expand Up @@ -376,7 +373,6 @@ QVariantMap QgsRandomPointsInPolygonsAlgorithm::processAlgorithm( const QVariant
{
missedPolygons++;
}
featureCount++;
feedback->setProgress( baseFeatureProgress );
} // while features
missedPoints = desiredNumberOfPoints - totNPoints;
Expand Down
4 changes: 0 additions & 4 deletions src/analysis/processing/qgsalgorithmrandompointsonlines.cpp
Expand Up @@ -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 );
Expand All @@ -236,7 +235,6 @@ QVariantMap QgsRandomPointsOnLinesAlgorithm::processAlgorithm( const QVariantMap
{
// Increment invalid features count
emptyOrNullGeom++;
featureCount++;
baseFeatureProgress += featureProgressStep;
feedback->setProgress( baseFeatureProgress );
continue;
Expand All @@ -246,7 +244,6 @@ QVariantMap QgsRandomPointsOnLinesAlgorithm::processAlgorithm( const QVariantMap
{
// Increment invalid features count
emptyOrNullGeom++;
featureCount++;
baseFeatureProgress += featureProgressStep;
feedback->setProgress( baseFeatureProgress );
continue;
Expand Down Expand Up @@ -364,7 +361,6 @@ QVariantMap QgsRandomPointsOnLinesAlgorithm::processAlgorithm( const QVariantMap
{
missedLines++;
}
featureCount++;
feedback->setProgress( baseFeatureProgress );
} // while features
missedPoints = desiredNumberOfPoints - totNPoints;
Expand Down
3 changes: 0 additions & 3 deletions src/analysis/vector/qgsgeometrysnappersinglesource.cpp
Expand Up @@ -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;
Expand All @@ -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 )
{
Expand Down
2 changes: 0 additions & 2 deletions src/app/qgsappbrowserproviders.cpp
Expand Up @@ -1186,15 +1186,13 @@ 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 );
for ( const QgsBookmark &bookmark : matching )
{
manager->removeBookmark( bookmark.id() );
}
i++;
}
}
} );
Expand Down
5 changes: 2 additions & 3 deletions src/app/qgsidentifyresultsdialog.cpp
Expand Up @@ -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 );
Expand Down
6 changes: 5 additions & 1 deletion src/core/auth/qgsauthmanager.cpp
Expand Up @@ -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() )
{
Expand Down Expand Up @@ -3948,4 +3953,3 @@ void QgsAuthManager::insertCaCertInCache( QgsAuthCertUtils::CaCertSource source,
QPair<QgsAuthCertUtils::CaCertSource, QSslCertificate>( source, cert ) );
}
}

2 changes: 0 additions & 2 deletions src/core/layout/qgslayoutmodel.cpp
Expand Up @@ -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() )
{
Expand All @@ -343,7 +342,6 @@ bool QgsLayoutModel::dropMimeData( const QMimeData *data,
if ( item )
{
droppedItems << item;
++rows;
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/core/pal/feature.cpp
Expand Up @@ -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++ )
Expand All @@ -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];
Expand Down
2 changes: 0 additions & 2 deletions src/core/pal/problem.cpp
Expand Up @@ -585,7 +585,6 @@ void Problem::chainSearch( QgsRenderContext & )
bool *ok = new bool[mFeatureCount];
int fid;
int lid;
int popit = 0;

Chain *retainedChain = nullptr;

Expand Down Expand Up @@ -655,7 +654,6 @@ void Problem::chainSearch( QgsRenderContext & )
}

delete_chain( retainedChain );
popit++;
}

delete[] ok;
Expand Down
3 changes: 0 additions & 3 deletions src/core/pointcloud/qgspointcloudlayerexporter.cpp
Expand Up @@ -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() );
Expand Down Expand Up @@ -397,7 +396,6 @@ void QgsPointCloudLayerExporter::ExporterBase::run()
! mParent->mExtent.contains( x, y ) ||
( mParent->mFilterGeometryEngine && ! mParent->mFilterGeometryEngine->contains( x, y ) ) )
{
++pointsSkipped;
continue;
}

Expand All @@ -411,7 +409,6 @@ void QgsPointCloudLayerExporter::ExporterBase::run()
catch ( const QgsCsException &cse )
{
QgsDebugMsg( QStringLiteral( "Error transforming point: %1" ).arg( cse.what() ) );
++pointsSkipped;
}
}
handleNode();
Expand Down
4 changes: 0 additions & 4 deletions src/core/qgsjsonutils.cpp
Expand Up @@ -144,7 +144,6 @@ json QgsJsonExporter::exportFeatureToJsonObject( const QgsFeature &feature, cons
}

// build up properties element
int attributeCounter { 0 };
json properties;
if ( mIncludeAttributes || !extraProperties.isEmpty() )
{
Expand Down Expand Up @@ -180,7 +179,6 @@ json QgsJsonExporter::exportFeatureToJsonObject( const QgsFeature &feature, cons
name = mLayer->attributeDisplayName( i );
}
properties[ name.toStdString() ] = QgsJsonUtils::jsonFromVariant( val );
attributeCounter++;
}
}

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

Expand Down Expand Up @@ -224,7 +221,6 @@ json QgsJsonExporter::exportFeatureToJsonObject( const QgsFeature &feature, cons
}
}
properties[ relation.name().toStdString() ] = relatedFeatureAttributes;
attributeCounter++;
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/core/symbology/qgslinesymbollayer.cpp
Expand Up @@ -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;
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -464,7 +463,6 @@ void QgsDelimitedTextProvider::scanFile( bool buildIndexes, bool forceFullScan,
// Skip over empty records
if ( recordIsEmpty( parts ) )
{
nEmptyRecords++;
continue;
}

Expand Down
2 changes: 0 additions & 2 deletions src/providers/oracle/qgsoracleconn.cpp
Expand Up @@ -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() );
Expand Down

0 comments on commit d023880

Please sign in to comment.