Skip to content

Commit

Permalink
Merge pull request #59542 from nyalldawson/backport_59515
Browse files Browse the repository at this point in the history
Fix a bunch of coverity scan errors (LTR backport)
  • Loading branch information
troopa81 authored Nov 21, 2024
2 parents 5299842 + b5e3813 commit 768d167
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/3d/qgs3daxis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ void Qgs3DAxis::createAxisScene()
if ( axisDirections.length() > 0 )
mTextX->setText( QgsCoordinateReferenceSystemUtils::axisDirectionToAbbreviatedString( axisDirections.at( 0 ) ) );
else
mTextY->setText( "X?" );
mTextX->setText( "X?" );

if ( axisDirections.length() > 1 )
mTextY->setText( QgsCoordinateReferenceSystemUtils::axisDirectionToAbbreviatedString( axisDirections.at( 1 ) ) );
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmgltftovector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ QVariantMap QgsGltfToVectorFeaturesAlgorithm::processAlgorithm( const QVariantMa
{
QgsFeature f;
f.setGeometry( std::move( geometry ) );
polygonSink->addFeature( f, QgsFeatureSink::FastInsert );
lineSink->addFeature( f, QgsFeatureSink::FastInsert );
}
}
break;
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgscoordinateutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ double QgsCoordinateUtils::dmsToDecimal( const QString &string, bool *ok, bool *
value = !sign1.isEmpty() && negative.contains( sign1 ) ? -v : v;
if ( isEasting )
{
*isEasting = easting.contains( sign2 );
*isEasting = easting.contains( sign1 );
}
}
else
Expand Down
8 changes: 4 additions & 4 deletions src/core/qgspathresolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,12 @@ QString QgsPathResolver::setPathWriter( const std::function<QString( const QStri

bool QgsPathResolver::removePathWriter( const QString &id )
{
const size_t prevCount = sCustomWriters->size();
sCustomWriters()->erase( std::remove_if( sCustomWriters->begin(), sCustomWriters->end(), [id]( std::pair< QString, std::function< QString( const QString & ) > > &a )
const size_t prevCount = sCustomWriters()->size();
sCustomWriters()->erase( std::remove_if( sCustomWriters()->begin(), sCustomWriters()->end(), [id]( std::pair< QString, std::function< QString( const QString & ) > > &a )
{
return a.first == id;
} ), sCustomWriters->end() );
return prevCount != sCustomWriters->size();
} ), sCustomWriters()->end() );
return prevCount != sCustomWriters()->size();
}

QString QgsPathResolver::writePath( const QString &s ) const
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorfilewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3765,7 +3765,7 @@ QgsVectorFileWriter::WriterError QgsVectorFileWriter::writeAsVectorFormatV2( Qgs
if ( err != NoError )
return err;

return writeAsVectorFormatV2( details, fileName, transformContext, options, errorMessage, newFilename, newLayer );
return writeAsVectorFormatV2( details, fileName, transformContext, options, newFilename, newLayer, errorMessage );
}

QgsVectorFileWriter::WriterError QgsVectorFileWriter::writeAsVectorFormatV3( QgsVectorLayer *layer, const QString &fileName, const QgsCoordinateTransformContext &transformContext, const QgsVectorFileWriter::SaveVectorOptions &options, QString *errorMessage, QString *newFilename, QString *newLayer )
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgsrasterattributetable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ bool QgsRasterAttributeTable::insertField( int position, const Field &field, QSt
{
mType = Qgis::RasterAttributeTableType::Thematic;
}
else if ( field.usage == Qgis::RasterAttributeTableFieldUsage::Max || field.usage == Qgis::RasterAttributeTableFieldUsage::Max )
else if ( field.usage == Qgis::RasterAttributeTableFieldUsage::Min || field.usage == Qgis::RasterAttributeTableFieldUsage::Max )
{
mType = Qgis::RasterAttributeTableType::Athematic;
}
Expand Down
1 change: 0 additions & 1 deletion src/core/symbology/qgsfillsymbollayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2704,7 +2704,6 @@ QImage QgsLinePatternFillSymbolLayer::toTiledPatternImage() const
layerClone->drawPreviewIcon( symbolContext, pixmap.size() );
painter.end();
return pixmap.toImage();
return QImage();
}

double QgsLinePatternFillSymbolLayer::estimateMaxBleed( const QgsRenderContext & ) const
Expand Down
2 changes: 1 addition & 1 deletion src/core/textrenderer/qgstextbackgroundsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ QgsTextBackgroundSettings::~QgsTextBackgroundSettings() //NOLINT

bool QgsTextBackgroundSettings::operator==( const QgsTextBackgroundSettings &other ) const
{
if ( !d->enabled == other.enabled()
if ( d->enabled != other.enabled()
|| d->type != other.type()
|| d->svgFile != other.svgFile()
|| d->sizeType != other.sizeType()
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsrelationreferencewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ void QgsRelationReferenceWidget::filterChanged()
QgsAttributeList subset = attrs;

QString expression = filterExpression;
if ( ! filterExpression.isEmpty() && ! filtersAttrs.isEmpty() )
if ( ! expression.isEmpty() && ! filtersAttrs.isEmpty() )
expression += QLatin1String( " AND " );

expression += filtersAttrs.isEmpty() ? QString() : QStringLiteral( " ( " );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/layout/qgslayoutelevationprofilewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ void QgsLayoutElevationProfileWidget::setGuiElementValues()
mDistanceAxisMinorLinesSymbolButton->setSymbol( mProfile->plot()->xAxis().gridMinorSymbol()->clone() );
if ( mProfile->plot()->yAxis().gridMajorSymbol() )
mElevationAxisMajorLinesSymbolButton->setSymbol( mProfile->plot()->yAxis().gridMajorSymbol()->clone() );
if ( mProfile->plot()->yAxis().gridMajorSymbol() )
if ( mProfile->plot()->yAxis().gridMinorSymbol() )
mElevationAxisMinorLinesSymbolButton->setSymbol( mProfile->plot()->yAxis().gridMinorSymbol()->clone() );

mDistanceAxisLabelFontButton->setTextFormat( mProfile->plot()->xAxis().textFormat() );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgslayermetadataresultsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void QgsLayerMetadataResultsModel::reloadAsync()

void QgsLayerMetadataResultsModel::resultsReady( const QgsLayerMetadataSearchResults &results )
{
mFeedback->setProgress( mFeedback->progress() + 100 / QgsApplication::instance()->layerMetadataProviderRegistry()->layerMetadataProviders().count() );
mFeedback->setProgress( mFeedback->progress() + static_cast< double >( 100 ) / QgsApplication::instance()->layerMetadataProviderRegistry()->layerMetadataProviders().count() );
beginInsertRows( QModelIndex(), mResult.metadata().count(), mResult.metadata().count() + results.metadata().count() - 1 );
const QList<QgsLayerMetadataProviderResult> metadata { results.metadata() };
for ( const QgsLayerMetadataProviderResult &result : std::as_const( metadata ) )
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsmaptoolcapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ bool QgsMapToolCapture::tracingAddVertex( const QgsPointXY &point )
{
const QgsGeometry linear = QgsGeometry( mCaptureCurve.segmentize() );
const QgsGeometry curved = linear.convertToCurves(
QgsSettingsRegistryCore::settingsDigitizingConvertToCurveAngleTolerance->value(),
QgsSettingsRegistryCore::settingsDigitizingConvertToCurveDistanceTolerance->value()
QgsSettingsRegistryCore::settingsDigitizingConvertToCurveDistanceTolerance->value(),
QgsSettingsRegistryCore::settingsDigitizingConvertToCurveAngleTolerance->value()
);
if ( QgsWkbTypes::flatType( curved.wkbType() ) != Qgis::WkbType::CompoundCurve )
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsnewvectortabledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ QgsNewVectorTableDialog::QgsNewVectorTableDialog( QgsAbstractDatabaseProviderCon
mHasZChk->setEnabled( false );
mHasZChk->setChecked( false );
}
if ( ! hasM && ! hasM )
if ( ! hasM && ! hasZ )
{
mHasZChk->setVisible( false );
mHasMChk->setVisible( false );
Expand Down

0 comments on commit 768d167

Please sign in to comment.