Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverity fixes #60555

Merged
merged 4 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/core/elevation/qgsabstractprofilesurfacegenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ QVector<QgsProfileIdentifyResults> QgsAbstractProfileSurfaceResults::identify( c
prevElevation = it.value();
}
if ( result.has_value() )
return {result.value()};
return {*result};
else
return {};
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/labeling/qgstextlabelfeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class CORE_EXPORT QgsTextLabelFeature : public QgsLabelFeature
* \see setTextMetrics()
* \since QGIS 3.20
*/
const QgsPrecalculatedTextMetrics *textMetrics() const { return mTextMetrics.has_value() ? &mTextMetrics.value() : nullptr; }
const QgsPrecalculatedTextMetrics *textMetrics() const { return mTextMetrics.has_value() ? &( *mTextMetrics ) : nullptr; }

/**
* Sets additional text \a metrics required for curved label placement.
Expand Down
2 changes: 1 addition & 1 deletion src/core/pointcloud/expression/qgspointcloudexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ QList<const QgsPointCloudExpressionNode *> QgsPointCloudExpression::nodes() cons
bool QgsPointCloudExpression::checkExpression( const QgsExpression &expression, const QgsPointCloudBlock *block, QString &errorMessage )
{
QgsPointCloudExpression exp( expression );
exp.prepare( block );
( void )exp.prepare( block );
errorMessage = exp.parserErrorString();
return !exp.hasParserError();
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/pointcloud/qgspointclouddataprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ struct MapIndexedPointCloudNode
// here we check the flag set in header to determine if we need to
// parse the time as GPS week time or GPS adjusted standard time
// however often times the flag is set wrong, so we determine if the value is bigger than the maximum amount of seconds in week then it has to be adjusted standard time
if ( copcTimeFlag.value() || pointAttr[QStringLiteral( "GpsTime" )].toDouble() > numberOfSecsInWeek )
if ( *copcTimeFlag || pointAttr[QStringLiteral( "GpsTime" )].toDouble() > numberOfSecsInWeek )
{
const QString utcTime = gpsBaseTime.addSecs( static_cast<qint64>( pointAttr[QStringLiteral( "GpsTime" )].toDouble() + 1e9 ) ).toString( Qt::ISODate );
pointAttr[ QStringLiteral( "GpsTime (raw)" )] = pointAttr[QStringLiteral( "GpsTime" )];
Expand Down
4 changes: 2 additions & 2 deletions src/core/pointcloud/qgspointcloudlayerundocommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ class CORE_EXPORT QgsPointCloudLayerUndoCommandChangeAttribute : public QgsPoint
QgsPointCloudNodeId mNode;
QHash< int, double > mPointValues; // contains pairs of (point number, old value)
QgsPointCloudAttribute mAttribute;
int mAttributeOffset;
double mNewValue;
int mAttributeOffset = 0;
double mNewValue = 0;
bool mFirstEditForNode = false;
};
#endif // QGSPOINTCLOUDLAYERUNDOCOMMAND_H
4 changes: 2 additions & 2 deletions src/core/settings/qgssettingsproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ class CORE_EXPORT QgsSettingsProxy
*/
QgsSettings *operator->()
{
return mOwnedSettings.has_value() ? &( mOwnedSettings.value() ) : mNonOwnedSettings;
return mOwnedSettings.has_value() ? &( *mOwnedSettings ) : mNonOwnedSettings;
}

/**
* Returns a reference to the proxied QgsSettings object.
*/
QgsSettings &operator* ()
{
return mOwnedSettings.has_value() ? mOwnedSettings.value() : *mNonOwnedSettings;
return mOwnedSettings.has_value() ? *mOwnedSettings : *mNonOwnedSettings;
}

private:
Expand Down
14 changes: 7 additions & 7 deletions src/gui/auth/qgsauthmasterpassresetdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ QgsMasterPasswordResetDialog::QgsMasterPasswordResetDialog( QWidget *parent )
{
chkKeepBackup->hide();
}
}

QString warning = tr( "The authentication store will be re-encrypted using the new password." );
if ( QgsApplication::authManager()->passwordHelperEnabled() )
{
warning += QStringLiteral( "<p><b>%1</b></p>" ).arg( tr( "The new password will automatically be stored in the system %1." ).arg( QgsAuthManager::passwordHelperDisplayName() ) );
}
QString warning = tr( "The authentication store will be re-encrypted using the new password." );
if ( QgsApplication::authManager()->passwordHelperEnabled() )
{
warning += QStringLiteral( "<p><b>%1</b></p>" ).arg( tr( "The new password will automatically be stored in the system %1." ).arg( QgsAuthManager::passwordHelperDisplayName() ) );
}

lblWarning->setText( warning );
lblWarning->setText( warning );
}
}

QgsPasswordLineEdit *QgsMasterPasswordResetDialog::oldPasswordLineEdit()
Expand Down
Loading