Skip to content
Permalink
Browse files

Coverity fixes

  • Loading branch information
nyalldawson committed Sep 28, 2015
1 parent 7c03619 commit c5f464bbab796e5a2731f361d786b9b39edf2563
@@ -36,6 +36,7 @@ QgsMapToolNodeTool::QgsMapToolNodeTool( QgsMapCanvas* canvas )
, mNodeEditor( 0 )
, mMoving( true )
, mSelectAnother( false )
, mAnother( 0 )
, mSelectionRubberBand( 0 )
, mRect( 0 )
, mIsPoint( false )
@@ -9555,7 +9555,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionCopyFeatures->setEnabled( layerHasSelection );
mActionFeatureAction->setEnabled( layerHasActions );

if ( !isEditable && mMapCanvas->mapTool()
if ( !isEditable && mMapCanvas && mMapCanvas->mapTool()
&& mMapCanvas->mapTool()->isEditTool() && !mSaveRollbackInProgress )
{
mMapCanvas->setMapTool( mNonEditMapTool );
@@ -744,7 +744,7 @@ void QgsAttributeTableDialog::filterQueryChanged( const QString& query )
{
str = query;
}
else
else if ( mCurrentSearchWidgetWrapper )
{
str = mCurrentSearchWidgetWrapper->expression();
}
@@ -189,7 +189,7 @@ void QgsVariantDelegate::setModelData( QWidget* editor, QAbstractItemModel* mode
value = text.at( 0 );
break;
case QVariant::Color:
mColorExp.exactMatch( text );
( void )mColorExp.exactMatch( text );
value = QColor( qMin( mColorExp.cap( 1 ).toInt(), 255 ),
qMin( mColorExp.cap( 2 ).toInt(), 255 ),
qMin( mColorExp.cap( 3 ).toInt(), 255 ),
@@ -212,16 +212,16 @@ void QgsVariantDelegate::setModelData( QWidget* editor, QAbstractItemModel* mode
}
break;
case QVariant::Point:
mPointExp.exactMatch( text );
( void )mPointExp.exactMatch( text );
value = QPoint( mPointExp.cap( 1 ).toInt(), mPointExp.cap( 2 ).toInt() );
break;
case QVariant::Rect:
mRectExp.exactMatch( text );
( void )mRectExp.exactMatch( text );
value = QRect( mRectExp.cap( 1 ).toInt(), mRectExp.cap( 2 ).toInt(),
mRectExp.cap( 3 ).toInt(), mRectExp.cap( 4 ).toInt() );
break;
case QVariant::Size:
mSizeExp.exactMatch( text );
( void )mSizeExp.exactMatch( text );
value = QSize( mSizeExp.cap( 1 ).toInt(), mSizeExp.cap( 2 ).toInt() );
break;
case QVariant::StringList:
@@ -84,7 +84,7 @@ QSqlDatabase QgsAuthManager::authDbConnection() const
authdb = QSqlDatabase::database( connectionname );
}
if ( !authdb.isOpen() )
authdb.open();
( void )authdb.open();

return authdb;
}
@@ -3230,7 +3230,7 @@ bool QgsAuthManager::authDbQuery( QSqlQuery *query ) const
return false;

query->setForwardOnly( true );
query->exec();
( void )query->exec();

if ( query->lastError().isValid() )
{
@@ -43,6 +43,7 @@
#include "labelposition.h"
#include "problem.h"
#include "pointset.h"
#include "internalexception.h"
#include "util.h"
#include <QTime>
#include <cstdarg>
@@ -586,12 +587,19 @@ namespace pal

prob->reduce();

if ( searchMethod == FALP )
prob->init_sol_falp();
else if ( searchMethod == CHAIN )
prob->chain_search();
else
prob->popmusic();
try
{
if ( searchMethod == FALP )
prob->init_sol_falp();
else if ( searchMethod == CHAIN )
prob->chain_search();
else
prob->popmusic();
}
catch ( InternalException::Empty )
{
return new std::list<LabelPosition*>();
}

return prob->getSolution( displayAll );
}
@@ -353,6 +353,7 @@ QgsLabelFeature::QgsLabelFeature( QgsFeatureId id, GEOSGeometry* geometry, const
, mPriority( -1 )
, mHasFixedPosition( false )
, mHasFixedAngle( false )
, mFixedAngle( 0 )
, mHasFixedQuadrant( false )
, mDistLabel( 0 )
, mRepeatDistance( 0 )
@@ -31,6 +31,7 @@ QgsRenderContext::QgsRenderContext()
, mRasterScaleFactor( 1.0 )
, mRendererScale( 1.0 )
, mLabelingEngine( NULL )
, mLabelingEngine2( 0 )
, mShowSelection( true )
, mUseRenderingOptimization( true )
, mGeometry( 0 )
@@ -472,7 +472,7 @@ void QgsVectorLayerLabelProvider::drawLabelPrivate( pal::LabelPosition* label, Q
{

// TODO: optimize access :)
QgsTextLabelFeature* lf = dynamic_cast<QgsTextLabelFeature*>( label->getFeaturePart()->feature() );
QgsTextLabelFeature* lf = static_cast<QgsTextLabelFeature*>( label->getFeaturePart()->feature() );
QString txt = lf->text( label->getPartId() );
QFontMetricsF* labelfm = lf->labelFontMetrics();

@@ -46,6 +46,7 @@ QgsAuthAuthoritiesEditor::QgsAuthAuthoritiesEditor( QWidget *parent )
, mRootCaSecItem( 0 )
, mFileCaSecItem( 0 )
, mDbCaSecItem( 0 )
, mDefaultTrustPolicy( QgsAuthCertUtils::DefaultTrust )
, mUtilitiesMenu( 0 )
, mActionDefaultTrustPolicy( 0 )
, mActionShowTrustedCAs( 0 )
@@ -355,9 +355,10 @@ void QgsAuthConfigEdit::validateAuth()
{
QgsDebugMsg( QString( "Cast to edit widget FAILED" ) );
}

authok = authok && editWidget->validateConfig();

else
{
authok = authok && editWidget->validateConfig();
}
authok = authok && authCfgEdit->validate();

buttonBox->button( QDialogButtonBox::Save )->setEnabled( authok );
@@ -42,8 +42,6 @@ class GUI_EXPORT QgsAuthMethodPlugins : public QDialog, private Ui::QgsAuthMetho

private:
void setupTable();
QVBoxLayout *mAuthNotifyLayout;
QLabel *mAuthNotify;
};


@@ -86,7 +86,7 @@ void QgsAuthGuiUtils::setMasterPassword( QgsMessageBar *msgbar, int timeout )
QgsMessageBar::INFO, timeout );
return;
}
QgsAuthManager::instance()->setMasterPassword( true );
( void )QgsAuthManager::instance()->setMasterPassword( true );
}

void QgsAuthGuiUtils::clearCachedMasterPassword( QgsMessageBar *msgbar, int timeout )
@@ -163,7 +163,6 @@ class GUI_EXPORT QgsAuthSslConfigWidget : public QWidget, private Ui::QgsAuthSsl
QSslCertificate mCert;
QList<QSslCertificate> mConnectionCAs;

QTreeWidgetItem *mRootItem;
QTreeWidgetItem *mProtocolItem;
QComboBox *mProtocolCmbBx;
QTreeWidgetItem *mIgnoreErrorsItem;
@@ -297,6 +297,11 @@ void QgsGeometrySelfIntersectionCheck::fixError( QgsGeometryCheckError* error, i
changes[newFeature.id()].append( Change( ChangeFeature, ChangeAdded ) );
}
}
else
{
delete ringGeom1;
delete ringGeom2;
}
error->setFixed( method );
}
else
@@ -19,7 +19,10 @@
#include "ui/qgsgeometrycheckerdialog.h"

QgsGeometryCheckerPlugin::QgsGeometryCheckerPlugin( QgisInterface* iface )
: QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ), mIface( iface )
: QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType )
, mIface( iface )
, mDialog( 0 )
, mMenuAction( 0 )
{
}

@@ -333,6 +333,7 @@ void QgsGeometryCheckerResultTab::highlightErrors( bool current )
{
// QgsGeometry above takes ownership of geometry and deletes it when it goes out of scope
delete geometry;
geometry = 0;
}

if ( ui.radioButtonError->isChecked() || current || error->status() == QgsGeometryCheckError::StatusFixed )
@@ -345,7 +346,7 @@ void QgsGeometryCheckerResultTab::highlightErrors( bool current )
mCurrentRubberBands.append( pointRubberBand );
errorPositions.append( pos );
}
else if ( ui.radioButtonFeature->isChecked() )
else if ( ui.radioButtonFeature->isChecked() && geometry )
{
QgsRectangle geomextent = mIface->mapCanvas()->mapSettings().layerExtentToOutputExtent( mFeaturePool->getLayer(), geometry->boundingBox() );
if ( totextent.isEmpty() )
@@ -18,8 +18,10 @@
#include "qgisinterface.h"

QgsGeometrySnapperPlugin::QgsGeometrySnapperPlugin( QgisInterface* iface )
: QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ),
mIface( iface )
: QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType )
, mIface( iface )
, mDialog( 0 )
, mMenuAction( 0 )
{
}

@@ -212,7 +212,7 @@ void QgsMssqlNewConnection::listDatabases()
{
QSqlQuery query = QSqlQuery( db );
query.setForwardOnly( true );
query.exec( queryStr );
( void )query.exec( queryStr );

if ( !txtService->text().isEmpty() )
{
@@ -1675,6 +1675,7 @@ QgsWcsDownloadHandler::QgsWcsDownloadHandler( const QUrl& url, QgsWcsAuthorizati
: mNAM( new QgsNetworkAccessManager )
, mAuth( auth )
, mEventLoop( new QEventLoop )
, mCacheReply( 0 )
, mCachedData( cachedData )
, mWcsVersion( wcsVersion )
, mCachedError( cachedError )

0 comments on commit c5f464b

Please sign in to comment.
You can’t perform that action at this time.