From a3668f585300638d32e927221ced711699051a12 Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Sat, 7 Feb 2015 02:31:42 +0100 Subject: [PATCH] more coverity fixes --- src/analysis/raster/qgsrastercalcnode.cpp | 1 + src/analysis/vector/qgsoverlayanalyzer.cpp | 8 +- src/app/composer/qgscomposerlegendwidget.cpp | 7 +- src/app/ogr/qgsvectorlayersaveasdialog.cpp | 51 +- src/app/pluginmanager/qgspluginmanager.cpp | 4 +- src/app/qgisapp.cpp | 9 +- src/app/qgsaddattrdialog.cpp | 3 + src/app/qgsapplayertreeviewmenuprovider.cpp | 5 +- src/app/qgslabelpropertydialog.cpp | 33 +- src/app/qgsvectorlayerproperties.cpp | 9 +- src/core/composer/qgscomposition.cpp | 8 +- src/core/composer/qgslegendmodel.cpp | 6 +- src/core/pal/problem.cpp | 2 +- src/core/qgsgml.cpp | 1 + src/core/qgsmaplayer.cpp | 5 +- src/core/qgsvectorfilewriter.cpp | 12 +- src/core/qgsvectorlayer.cpp | 17 +- src/core/raster/qgsrasterfilewriter.cpp | 4 +- src/core/raster/qgsrasterprojector.cpp | 19 +- .../qgscategorizedsymbolrendererv2.cpp | 8 +- src/core/symbology-ng/qgscptcityarchive.cpp | 6 +- .../qgsvectorfieldsymbollayer.cpp | 4 +- .../qgslayertreeviewdefaultactions.cpp | 15 +- src/gui/qgsmaptoolidentify.cpp | 8 +- src/gui/qgsrelationeditorwidget.cpp | 5 + .../qgscptcitycolorrampv2dialog.cpp | 2 +- .../qgsgraduatedsymbolrendererv2widget.cpp | 13 +- .../dxf2shp_converter/dxflib/src/dl_dxf.cpp | 2 +- src/plugins/topology/topolTest.cpp | 13 +- .../spatialite/qgsspatialitedataitems.cpp | 2 +- src/providers/wms/qgswmssourceselect.cpp | 3 +- tests/src/core/testqgsgeometryimport.cpp | 3 +- .../src/core/testqgsmaplayerstylemanager.cpp | 9 +- tests/src/core/testqgsvectorlayer.cpp | 609 ++++-------------- tests/src/core/testziplayer.cpp | 2 +- 35 files changed, 306 insertions(+), 602 deletions(-) diff --git a/src/analysis/raster/qgsrastercalcnode.cpp b/src/analysis/raster/qgsrastercalcnode.cpp index 4d786d15193..ec43a9423b0 100644 --- a/src/analysis/raster/qgsrastercalcnode.cpp +++ b/src/analysis/raster/qgsrastercalcnode.cpp @@ -153,6 +153,7 @@ bool QgsRasterCalcNode::calculate( QMap& rasterData, break; case opATAN: leftMatrix.atangens(); + break; case opSIGN: leftMatrix.changeSign(); break; diff --git a/src/analysis/vector/qgsoverlayanalyzer.cpp b/src/analysis/vector/qgsoverlayanalyzer.cpp index d1d7ced2178..4d899223b78 100644 --- a/src/analysis/vector/qgsoverlayanalyzer.cpp +++ b/src/analysis/vector/qgsoverlayanalyzer.cpp @@ -31,14 +31,14 @@ bool QgsOverlayAnalyzer::intersection( QgsVectorLayer* layerA, QgsVectorLayer* l const QString& shapefileName, bool onlySelectedFeatures, QProgressDialog* p ) { - if ( !layerA && !layerB ) + if ( !layerA || !layerB ) { return false; } - QgsVectorDataProvider* dpA = layerA->dataProvider(); - QgsVectorDataProvider* dpB = layerB->dataProvider(); - if ( !dpA && !dpB ) + QgsVectorDataProvider *dpA = layerA->dataProvider(); + QgsVectorDataProvider *dpB = layerB->dataProvider(); + if ( !dpA || !dpB ) { return false; } diff --git a/src/app/composer/qgscomposerlegendwidget.cpp b/src/app/composer/qgscomposerlegendwidget.cpp index e8d012451bd..2347890c738 100644 --- a/src/app/composer/qgscomposerlegendwidget.cpp +++ b/src/app/composer/qgscomposerlegendwidget.cpp @@ -87,7 +87,9 @@ class QgsComposerLegendMenuProvider : public QObject, public QgsLayerTreeViewMen -QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend ): QgsComposerItemBaseWidget( 0, legend ), mLegend( legend ) +QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend ) + : QgsComposerItemBaseWidget( 0, legend ) + , mLegend( legend ) { setupUi( this ); @@ -113,10 +115,9 @@ QgsComposerLegendWidget::QgsComposerLegendWidget( QgsComposerLegend* legend ): Q if ( legend ) { connect( legend, SIGNAL( itemChanged() ), this, SLOT( setGuiElements() ) ); + mWrapCharLineEdit->setText( legend->wrapChar() ); } - mWrapCharLineEdit->setText( legend->wrapChar() ); - setGuiElements(); connect( mItemTreeView->selectionModel(), SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), diff --git a/src/app/ogr/qgsvectorlayersaveasdialog.cpp b/src/app/ogr/qgsvectorlayersaveasdialog.cpp index daf5f3d7c32..b8a37a2948a 100644 --- a/src/app/ogr/qgsvectorlayersaveasdialog.cpp +++ b/src/app/ogr/qgsvectorlayersaveasdialog.cpp @@ -115,39 +115,48 @@ QList > QgsVectorLayerSaveAsDialog::createControls( con { case QgsVectorFileWriter::Int: { - QgsVectorFileWriter::IntOption* opt = dynamic_cast( option ); - QSpinBox* sb = new QSpinBox(); - sb->setObjectName( it.key() ); - sb->setValue( opt->defaultValue ); - control = sb; + QgsVectorFileWriter::IntOption *opt = dynamic_cast( option ); + if ( opt ) + { + QSpinBox *sb = new QSpinBox(); + sb->setObjectName( it.key() ); + sb->setValue( opt->defaultValue ); + control = sb; + } break; } case QgsVectorFileWriter::Set: { - QgsVectorFileWriter::SetOption* opt = dynamic_cast( option ); - QComboBox* cb = new QComboBox(); - cb->setObjectName( it.key() ); - Q_FOREACH ( const QString& val, opt->values ) + QgsVectorFileWriter::SetOption *opt = dynamic_cast( option ); + if ( opt ) { - cb->addItem( val, val ); + QComboBox* cb = new QComboBox(); + cb->setObjectName( it.key() ); + Q_FOREACH ( const QString& val, opt->values ) + { + cb->addItem( val, val ); + } + if ( opt->allowNone ) + cb->addItem( tr( "" ), QVariant( QVariant::String ) ); + int idx = cb->findText( opt->defaultValue ); + if ( idx == -1 ) + idx = cb->findData( QVariant( QVariant::String ) ); + cb->setCurrentIndex( idx ); + control = cb; } - if ( opt->allowNone ) - cb->addItem( tr( "" ), QVariant( QVariant::String ) ); - int idx = cb->findText( opt->defaultValue ); - if ( idx == -1 ) - idx = cb->findData( QVariant( QVariant::String ) ); - cb->setCurrentIndex( idx ); - control = cb; break; } case QgsVectorFileWriter::String: { - QgsVectorFileWriter::StringOption* opt = dynamic_cast( option ); - QLineEdit* le = new QLineEdit( opt->defaultValue ); - le->setObjectName( it.key() ); - control = le; + QgsVectorFileWriter::StringOption *opt = dynamic_cast( option ); + if ( opt ) + { + QLineEdit* le = new QLineEdit( opt->defaultValue ); + le->setObjectName( it.key() ); + control = le; + } break; } diff --git a/src/app/pluginmanager/qgspluginmanager.cpp b/src/app/pluginmanager/qgspluginmanager.cpp index 081bcd45f3c..bee4f4ebba6 100644 --- a/src/app/pluginmanager/qgspluginmanager.cpp +++ b/src/app/pluginmanager/qgspluginmanager.cpp @@ -1226,8 +1226,8 @@ void QgsPluginManager::on_buttonUninstall_clicked() void QgsPluginManager::on_treeRepositories_itemSelectionChanged() { - buttonEditRep->setEnabled( ! treeRepositories -> selectedItems().isEmpty() ); - buttonDeleteRep->setEnabled( ! treeRepositories -> selectedItems().isEmpty() ); + buttonEditRep->setEnabled( ! treeRepositories->selectedItems().isEmpty() ); + buttonDeleteRep->setEnabled( ! treeRepositories->selectedItems().isEmpty() ); } diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index c700edfe500..dc73bea8452 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -713,7 +713,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, QgsPythonRunner::run( "import pyplugin_installer" ); QgsPythonRunner::run( "pyplugin_installer.initPluginInstaller()" ); // enable Python in the Plugin Manager and pass the PythonUtils to it - mPluginManager -> setPythonUtils( mPythonUtils ); + mPluginManager->setPythonUtils( mPythonUtils ); } else { @@ -2988,13 +2988,16 @@ bool QgisApp::askUserForZipItemLayers( QString path ) foreach ( QgsDataItem* item, childItems ) { QgsLayerItem *layerItem = dynamic_cast( item ); + if ( !layerItem ) + continue; + QgsDebugMsg( QString( "item path=%1 provider=%2" ).arg( item->path() ).arg( layerItem->providerKey() ) ); - if ( layerItem && layerItem->providerKey() == "gdal" ) + if ( layerItem->providerKey() == "gdal" ) { if ( addRasterLayer( item->path(), QFileInfo( item->name() ).completeBaseName() ) ) ok = true; } - else if ( layerItem && layerItem->providerKey() == "ogr" ) + else if ( layerItem->providerKey() == "ogr" ) { if ( addVectorLayers( QStringList( item->path() ), "System", "file" ) ) ok = true; diff --git a/src/app/qgsaddattrdialog.cpp b/src/app/qgsaddattrdialog.cpp index aae49414d48..1b29e33ba32 100644 --- a/src/app/qgsaddattrdialog.cpp +++ b/src/app/qgsaddattrdialog.cpp @@ -28,6 +28,9 @@ QgsAddAttrDialog::QgsAddAttrDialog( QgsVectorLayer *vlayer, QWidget *parent, Qt: { setupUi( this ); + if ( !vlayer ) + return; + //fill data types into the combo box const QList< QgsVectorDataProvider::NativeType > &typelist = vlayer->dataProvider()->nativeTypes(); diff --git a/src/app/qgsapplayertreeviewmenuprovider.cpp b/src/app/qgsapplayertreeviewmenuprovider.cpp index 2e375440846..b64161c081b 100644 --- a/src/app/qgsapplayertreeviewmenuprovider.cpp +++ b/src/app/qgsapplayertreeviewmenuprovider.cpp @@ -217,8 +217,11 @@ bool QgsAppLayerTreeViewMenuProvider::removeLegendLayerAction( QAction* action ) void QgsAppLayerTreeViewMenuProvider::addLegendLayerActionForLayer( QAction* action, QgsMapLayer* layer ) { + if ( !action || !layer ) + return; + legendLayerActions( layer->type() ); - if ( !action || !layer || ! mLegendLayerActionMap.contains( layer->type() ) ) + if ( !mLegendLayerActionMap.contains( layer->type() ) ) return; QMap< QgsMapLayer::LayerType, QList< LegendLayerAction > >::iterator it diff --git a/src/app/qgslabelpropertydialog.cpp b/src/app/qgslabelpropertydialog.cpp index 0841ae0bd5b..67333cadc5b 100644 --- a/src/app/qgslabelpropertydialog.cpp +++ b/src/app/qgslabelpropertydialog.cpp @@ -80,20 +80,27 @@ void QgsLabelPropertyDialog::init( const QString& layerId, int featureId, const if ( !labelFieldName.isEmpty() ) { mCurLabelField = vlayer->fieldNameIndex( labelFieldName ); - mLabelTextLineEdit->setText( attributeValues[mCurLabelField].toString() ); - const QgsFields& layerFields = vlayer->pendingFields(); - switch ( layerFields[mCurLabelField].type() ) + if ( mCurLabelField >= 0 ) { - case QVariant::Double: - mLabelTextLineEdit->setValidator( new QDoubleValidator( this ) ); - break; - case QVariant::Int: - case QVariant::UInt: - case QVariant::LongLong: - mLabelTextLineEdit->setValidator( new QIntValidator( this ) ); - break; - default: - break; + mLabelTextLineEdit->setText( attributeValues[mCurLabelField].toString() ); + const QgsFields& layerFields = vlayer->pendingFields(); + switch ( layerFields[mCurLabelField].type() ) + { + case QVariant::Double: + mLabelTextLineEdit->setValidator( new QDoubleValidator( this ) ); + break; + case QVariant::Int: + case QVariant::UInt: + case QVariant::LongLong: + mLabelTextLineEdit->setValidator( new QIntValidator( this ) ); + break; + default: + break; + } + } + else + { + mLabelTextLineEdit->setEnabled( false ); } } } diff --git a/src/app/qgsvectorlayerproperties.cpp b/src/app/qgsvectorlayerproperties.cpp index ee7597da983..7849d14f557 100644 --- a/src/app/qgsvectorlayerproperties.cpp +++ b/src/app/qgsvectorlayerproperties.cpp @@ -293,9 +293,12 @@ QgsVectorLayerProperties::~QgsVectorLayerProperties() void QgsVectorLayerProperties::toggleEditing() { + if ( !layer ) + return; + emit toggleEditing( layer ); - pbnQueryBuilder->setEnabled( layer && layer->dataProvider() && layer->dataProvider()->supportsSubsetString() && + pbnQueryBuilder->setEnabled( layer->dataProvider() && layer->dataProvider()->supportsSubsetString() && !layer->isEditable() && layer->vectorJoins().size() < 1 ); if ( layer->isEditable() ) { @@ -381,7 +384,7 @@ void QgsVectorLayerProperties::syncToLayer( void ) // on the builder. If the ability to enter a query directly into the box is required, // a mechanism to check it must be implemented. txtSubsetSQL->setEnabled( false ); - pbnQueryBuilder->setEnabled( layer && layer->dataProvider() && layer->dataProvider()->supportsSubsetString() && + pbnQueryBuilder->setEnabled( layer->dataProvider() && layer->dataProvider()->supportsSubsetString() && !layer->isEditable() && layer->vectorJoins().size() < 1 ); if ( layer->isEditable() ) { @@ -396,7 +399,7 @@ void QgsVectorLayerProperties::syncToLayer( void ) fieldComboBox->addItem( myFields[idx].name() ); } - setDisplayField( layer-> displayField() ); + setDisplayField( layer->displayField() ); // set up the scale based layer visibility stuff.... mScaleRangeWidget->setScaleRange( 1.0 / layer->maximumScale(), 1.0 / layer->minimumScale() ); // caution: layer uses scale denoms, widget uses true scales diff --git a/src/core/composer/qgscomposition.cpp b/src/core/composer/qgscomposition.cpp index e6d63139ebf..c3dda8bddd4 100644 --- a/src/core/composer/qgscomposition.cpp +++ b/src/core/composer/qgscomposition.cpp @@ -1069,11 +1069,11 @@ void QgsComposition::addItemsFromXML( const QDomElement& elem, const QDomDocumen //since we are pasting items, clear the existing selection setAllUnselected(); - } - if ( pasteInPlace ) - { - pasteInPlacePt = new QPointF( 0, pageNumberAt( *pos ) * ( mPageHeight + mSpaceBetweenPages ) ); + if ( pasteInPlace ) + { + pasteInPlacePt = new QPointF( 0, pageNumberAt( *pos ) * ( mPageHeight + mSpaceBetweenPages ) ); + } } QDomNodeList composerLabelList = elem.elementsByTagName( "ComposerLabel" ); for ( int i = 0; i < composerLabelList.size(); ++i ) diff --git a/src/core/composer/qgslegendmodel.cpp b/src/core/composer/qgslegendmodel.cpp index 7fa2891231e..9c29667f0f5 100644 --- a/src/core/composer/qgslegendmodel.cpp +++ b/src/core/composer/qgslegendmodel.cpp @@ -662,7 +662,6 @@ bool QgsLegendModel::readXML( const QDomElement& legendModelElem, const QDomDocu QDomNodeList topLevelItemList = legendModelElem.childNodes(); QDomElement currentElem; - QgsComposerLegendItem* currentItem = 0; int nTopLevelItems = topLevelItemList.size(); for ( int i = 0; i < nTopLevelItems; ++i ) @@ -674,6 +673,7 @@ bool QgsLegendModel::readXML( const QDomElement& legendModelElem, const QDomDocu } //toplevel items can be groups or layers + QgsComposerLegendItem* currentItem = 0; if ( currentElem.tagName() == "LayerItem" ) { currentItem = new QgsComposerLayerItem(); @@ -682,6 +682,10 @@ bool QgsLegendModel::readXML( const QDomElement& legendModelElem, const QDomDocu { currentItem = new QgsComposerGroupItem(); } + + if ( !currentItem ) + continue; + currentItem->readXML( currentElem, mHasTopLevelWindow ); QList itemsList; diff --git a/src/core/pal/problem.cpp b/src/core/pal/problem.cpp index 33c79204a9a..dea18c58a08 100644 --- a/src/core/pal/problem.cpp +++ b/src/core/pal/problem.cpp @@ -2352,7 +2352,7 @@ namespace pal std::cout << "new_best" << std::endl; #endif best_cost = cur_cost; - memcpy( best_sol, sol, sizeof( int ) *subSize ); + memcpy( best_sol, sol, sizeof( int ) * subSize ); stop_it = ( it + itwimp > maxit ? maxit : it + itwimp ); } diff --git a/src/core/qgsgml.cpp b/src/core/qgsgml.cpp index 06a52fd87a7..72a7a70ee4f 100644 --- a/src/core/qgsgml.cpp +++ b/src/core/qgsgml.cpp @@ -431,6 +431,7 @@ void QgsGml::endElement( const XML_Char* el ) else { QgsDebugMsg( "No wkb fragments" ); + delete [] wkb; } } } diff --git a/src/core/qgsmaplayer.cpp b/src/core/qgsmaplayer.cpp index d1c8506fae1..93e77bbe151 100644 --- a/src/core/qgsmaplayer.cpp +++ b/src/core/qgsmaplayer.cpp @@ -641,7 +641,7 @@ QList QgsMapLayer::fromLayerDefinition( QDomDocument& document ) QString type = layerElem.attribute( "type" ); QgsDebugMsg( type ); - QgsMapLayer *layer = NULL; + QgsMapLayer *layer = 0; if ( type == "vector" ) { @@ -657,6 +657,9 @@ QList QgsMapLayer::fromLayerDefinition( QDomDocument& document ) layer = QgsPluginLayerRegistry::instance()->createLayer( typeName ); } + if ( !layer ) + continue; + bool ok = layer->readLayerXML( layerElem ); if ( ok ) layers << layer; diff --git a/src/core/qgsvectorfilewriter.cpp b/src/core/qgsvectorfilewriter.cpp index f9733139c6d..62651089728 100644 --- a/src/core/qgsvectorfilewriter.cpp +++ b/src/core/qgsvectorfilewriter.cpp @@ -2447,14 +2447,12 @@ QgsVectorFileWriter::WriterError QgsVectorFileWriter::exportFeaturesSymbolLevels const QgsCoordinateTransform* ct, QString* errorMessage ) { if ( !layer ) - { - //return error - } - QgsFeatureRendererV2* renderer = layer->rendererV2(); + return ErrInvalidLayer; + + QgsFeatureRendererV2 *renderer = layer->rendererV2(); if ( !renderer ) - { - //return error - } + return ErrInvalidLayer; + QHash< QgsSymbolV2*, QList > features; //unit type diff --git a/src/core/qgsvectorlayer.cpp b/src/core/qgsvectorlayer.cpp index dd91d1d77df..f552a4e635b 100644 --- a/src/core/qgsvectorlayer.cpp +++ b/src/core/qgsvectorlayer.cpp @@ -2907,17 +2907,20 @@ void QgsVectorLayer::uniqueValues( int index, QList &uniqueValues, int const QgsVectorJoinInfo* join = mJoinBuffer->joinForFieldIndex( index, mUpdatedFields, sourceLayerIndex ); Q_ASSERT( join ); - QgsVectorLayer* vl = dynamic_cast( QgsMapLayerRegistry::instance()->mapLayer( join->joinLayerId ) ); - Q_ASSERT( vl ); + QgsVectorLayer *vl = dynamic_cast( QgsMapLayerRegistry::instance()->mapLayer( join->joinLayerId ) ); - return vl->dataProvider()->uniqueValues( sourceLayerIndex, uniqueValues, limit ); + if ( vl ) + vl->dataProvider()->uniqueValues( sourceLayerIndex, uniqueValues, limit ); + + return; } else if ( origin == QgsFields::OriginEdit || origin == QgsFields::OriginExpression ) { // the layer is editable, but in certain cases it can still be avoided going through all features if ( origin == QgsFields::OriginEdit && mEditBuffer->mDeletedFeatureIds.isEmpty() && mEditBuffer->mAddedFeatures.isEmpty() && !mEditBuffer->mDeletedAttributeIds.contains( index ) && mEditBuffer->mChangedAttributeValues.isEmpty() ) { - return mDataProvider->uniqueValues( index, uniqueValues, limit ); + mDataProvider->uniqueValues( index, uniqueValues, limit ); + return; } // we need to go through each feature @@ -3608,10 +3611,16 @@ void QgsVectorLayer::onRelationsLoaded() if ( elem->type() == QgsAttributeEditorElement::AeTypeContainer ) { QgsAttributeEditorContainer* cont = dynamic_cast< QgsAttributeEditorContainer* >( elem ); + if ( !cont ) + continue; + QList relations = cont->findElements( QgsAttributeEditorElement::AeTypeRelation ); Q_FOREACH ( QgsAttributeEditorElement* relElem, relations ) { QgsAttributeEditorRelation* rel = dynamic_cast< QgsAttributeEditorRelation* >( relElem ); + if ( !rel ) + continue; + rel->init( QgsProject::instance()->relationManager() ); } } diff --git a/src/core/raster/qgsrasterfilewriter.cpp b/src/core/raster/qgsrasterfilewriter.cpp index 917787e930d..b36ea8e7d3d 100644 --- a/src/core/raster/qgsrasterfilewriter.cpp +++ b/src/core/raster/qgsrasterfilewriter.cpp @@ -321,7 +321,7 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster( QgsDebugMsg( "Entered" ); const QgsRasterInterface* iface = iter->input(); - const QgsRasterDataProvider* srcProvider = dynamic_cast( iface->srcInput() ); + const QgsRasterDataProvider *srcProvider = dynamic_cast( iface->srcInput() ); int nBands = iface->bandCount(); QgsDebugMsg( QString( "nBands = %1" ).arg( nBands ) ); @@ -405,7 +405,7 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster( QList destBlockList; for ( int i = 1; i <= nBands; ++i ) { - if ( srcProvider->dataType( i ) == destDataType ) + if ( srcProvider && srcProvider->dataType( i ) == destDataType ) { destBlockList.push_back( blockList[i-1] ); } diff --git a/src/core/raster/qgsrasterprojector.cpp b/src/core/raster/qgsrasterprojector.cpp index 6a9ea17f1a3..15f53fff08d 100644 --- a/src/core/raster/qgsrasterprojector.cpp +++ b/src/core/raster/qgsrasterprojector.cpp @@ -174,15 +174,18 @@ void QgsRasterProjector::calc() if ( mInput ) { QgsRasterDataProvider *provider = dynamic_cast( mInput->srcInput() ); - if ( provider && ( provider->capabilities() & QgsRasterDataProvider::Size ) ) + if ( provider ) { - mMaxSrcXRes = provider->extent().width() / provider->xSize(); - mMaxSrcYRes = provider->extent().height() / provider->ySize(); - } - // Get source extent - if ( mExtent.isEmpty() ) - { - mExtent = provider->extent(); + if ( provider->capabilities() & QgsRasterDataProvider::Size ) + { + mMaxSrcXRes = provider->extent().width() / provider->xSize(); + mMaxSrcYRes = provider->extent().height() / provider->ySize(); + } + // Get source extent + if ( mExtent.isEmpty() ) + { + mExtent = provider->extent(); + } } } diff --git a/src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp b/src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp index d6aac159338..9b69abf2ca5 100644 --- a/src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp +++ b/src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp @@ -806,12 +806,14 @@ QgsCategorizedSymbolRendererV2* QgsCategorizedSymbolRendererV2::convertFromRende if ( renderer->type() == "pointDisplacement" ) { const QgsPointDisplacementRenderer* pointDisplacementRenderer = dynamic_cast( renderer ); - return convertFromRenderer( pointDisplacementRenderer->embeddedRenderer() ); + if ( pointDisplacementRenderer ) + return convertFromRenderer( pointDisplacementRenderer->embeddedRenderer() ); } if ( renderer->type() == "invertedPolygonRenderer" ) { const QgsInvertedPolygonRenderer* invertedPolygonRenderer = dynamic_cast( renderer ); - return convertFromRenderer( invertedPolygonRenderer->embeddedRenderer() ); + if ( invertedPolygonRenderer ) + return convertFromRenderer( invertedPolygonRenderer->embeddedRenderer() ); } // If not one of the specifically handled renderers, then just grab the symbol from the renderer @@ -823,6 +825,6 @@ QgsCategorizedSymbolRendererV2* QgsCategorizedSymbolRendererV2::convertFromRende { r->setSourceSymbol( symbols.at( 0 )->clone() ); } - return r; + return r; } diff --git a/src/core/symbology-ng/qgscptcityarchive.cpp b/src/core/symbology-ng/qgscptcityarchive.cpp index 490109062f8..b9d8c26a3a8 100644 --- a/src/core/symbology-ng/qgscptcityarchive.cpp +++ b/src/core/symbology-ng/qgscptcityarchive.cpp @@ -794,8 +794,10 @@ bool QgsCptCityColorRampItem::equal( const QgsCptCityDataItem *other ) } //const QgsCptCityColorRampItem *o = qobject_cast ( other ); const QgsCptCityColorRampItem *o = dynamic_cast( other ); - return ( mPath == o->mPath && mName == o->mName && - ramp().variantName() == o->ramp().variantName() ); + return o && + mPath == o->mPath && + mName == o->mName && + ramp().variantName() == o->ramp().variantName(); } QIcon QgsCptCityColorRampItem::icon() diff --git a/src/core/symbology-ng/qgsvectorfieldsymbollayer.cpp b/src/core/symbology-ng/qgsvectorfieldsymbollayer.cpp index cda9f08b6e9..4d7f878bb91 100644 --- a/src/core/symbology-ng/qgsvectorfieldsymbollayer.cpp +++ b/src/core/symbology-ng/qgsvectorfieldsymbollayer.cpp @@ -164,12 +164,12 @@ void QgsVectorFieldSymbolLayer::renderPoint( const QPointF& point, QgsSymbolV2Re double yComponent = 0; double xVal = 0; - if ( mXIndex != -1 ) + if ( f && mXIndex != -1 ) { xVal = f->attribute( mXIndex ).toDouble(); } double yVal = 0; - if ( mYIndex != -1 ) + if ( f && mYIndex != -1 ) { yVal = f->attribute( mYIndex ).toDouble(); } diff --git a/src/gui/layertree/qgslayertreeviewdefaultactions.cpp b/src/gui/layertree/qgslayertreeviewdefaultactions.cpp index 7f2828da277..8a9923327ac 100644 --- a/src/gui/layertree/qgslayertreeviewdefaultactions.cpp +++ b/src/gui/layertree/qgslayertreeviewdefaultactions.cpp @@ -204,13 +204,16 @@ void QgsLayerTreeViewDefaultActions::zoomToLayers( QgsMapCanvas* canvas, const Q QgsRectangle layerExtent = layer->extent(); QgsVectorLayer *vLayer = qobject_cast( layer ); - if ( vLayer && vLayer->geometryType() == QGis::NoGeometry ) - continue; - - if ( layerExtent.isEmpty() && layer->type() == QgsMapLayer::VectorLayer ) + if ( vLayer ) { - qobject_cast( layer )->updateExtents(); - layerExtent = vLayer->extent(); + if ( vLayer->geometryType() == QGis::NoGeometry ) + continue; + + if ( layerExtent.isEmpty() ) + { + vLayer->updateExtents(); + layerExtent = vLayer->extent(); + } } if ( layerExtent.isNull() ) diff --git a/src/gui/qgsmaptoolidentify.cpp b/src/gui/qgsmaptoolidentify.cpp index 3b676010993..888edd0a5cc 100644 --- a/src/gui/qgsmaptoolidentify.cpp +++ b/src/gui/qgsmaptoolidentify.cpp @@ -357,8 +357,11 @@ bool QgsMapToolIdentify::identifyRasterLayer( QList *results, Qg return false; QgsRasterDataProvider *dprovider = layer->dataProvider(); + if ( !dprovider ) + return false; + int capabilities = dprovider->capabilities(); - if ( !dprovider || !( capabilities & QgsRasterDataProvider::Identify ) ) + if ( !( capabilities & QgsRasterDataProvider::Identify ) ) return false; QgsPoint pointInCanvasCrs = point; @@ -374,7 +377,8 @@ bool QgsMapToolIdentify::identifyRasterLayer( QList *results, Qg } QgsDebugMsg( QString( "point = %1 %2" ).arg( point.x() ).arg( point.y() ) ); - if ( !layer->extent().contains( point ) ) return false; + if ( !layer->extent().contains( point ) ) + return false; QMap< QString, QString > attributes, derivedAttributes; diff --git a/src/gui/qgsrelationeditorwidget.cpp b/src/gui/qgsrelationeditorwidget.cpp index a21511e2c93..7a37d9cf385 100644 --- a/src/gui/qgsrelationeditorwidget.cpp +++ b/src/gui/qgsrelationeditorwidget.cpp @@ -246,6 +246,11 @@ void QgsRelationEditorWidget::unlinkFeature() Q_FOREACH ( const QgsRelation::FieldPair fieldPair, mRelation.fieldPairs() ) { int idx = mRelation.referencingLayer()->fieldNameIndex( fieldPair.referencingField() ); + if ( idx < 0 ) + { + QgsDebugMsg( QString( "referencing field %1 not found" ).arg( fieldPair.referencingField() ) ); + return; + } QgsField fld = mRelation.referencingLayer()->pendingFields().at( idx ); keyFields.insert( idx, fld ); } diff --git a/src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp b/src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp index 74390f35343..10786e30988 100644 --- a/src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp +++ b/src/gui/symbology-ng/qgscptcitycolorrampv2dialog.cpp @@ -314,7 +314,7 @@ void QgsCptCityColorRampV2Dialog::on_mListWidget_itemClicked( QListWidgetItem * } else { - QgsDebugMsg( QString( "item %1 has invalid type %2" ).arg( rampItem->path() ).arg(( int )rampItem->type() ) ); + QgsDebugMsg( "invalid item" ); } } diff --git a/src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp b/src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp index 214e180f0c8..e12e0ff5cc8 100644 --- a/src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp +++ b/src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp @@ -548,9 +548,8 @@ void QgsGraduatedSymbolRendererV2Widget::classifyGraduated() int nclasses = spinGraduatedClasses->value(); - QgsVectorColorRampV2* ramp = cboGraduatedColorRamp->currentColorRamp(); - - if ( ramp == NULL ) + QSharedPointer ramp( cboGraduatedColorRamp->currentColorRamp() ); + if ( !ramp ) { if ( cboGraduatedColorRamp->count() == 0 ) QMessageBox::critical( this, tr( "Error" ), tr( "There are no available color ramps. You can add them in Style Manager." ) ); @@ -571,13 +570,12 @@ void QgsGraduatedSymbolRendererV2Widget::classifyGraduated() else // default should be quantile for now mode = QgsGraduatedSymbolRendererV2::Quantile; - // Jenks is n^2 complexity, warn for big dataset (more than 50k records) // and give the user the chance to cancel - if ( QgsGraduatedSymbolRendererV2::Jenks == mode - && mLayer->featureCount() > 50000 ) + if ( QgsGraduatedSymbolRendererV2::Jenks == mode && mLayer->featureCount() > 50000 ) { - if ( QMessageBox::Cancel == QMessageBox::question( this, tr( "Warning" ), tr( "Natural break classification (Jenks) is O(n2) complexity, your classification may take a long time.\nPress cancel to abort breaks calculation or OK to continue." ), QMessageBox::Cancel, QMessageBox::Ok ) ) return; + if ( QMessageBox::Cancel == QMessageBox::question( this, tr( "Warning" ), tr( "Natural break classification (Jenks) is O(n2) complexity, your classification may take a long time.\nPress cancel to abort breaks calculation or OK to continue." ), QMessageBox::Cancel, QMessageBox::Ok ) ) + return; } // create and set new renderer @@ -585,6 +583,7 @@ void QgsGraduatedSymbolRendererV2Widget::classifyGraduated() mRenderer->setClassAttribute( attrName ); mRenderer->setMode( mode ); mRenderer->setSourceColorRamp( ramp->clone() ); + QApplication::setOverrideCursor( Qt::WaitCursor ); mRenderer->updateClasses( mLayer, mode, nclasses ); mRenderer->calculateLabelPrecision(); diff --git a/src/plugins/dxf2shp_converter/dxflib/src/dl_dxf.cpp b/src/plugins/dxf2shp_converter/dxflib/src/dl_dxf.cpp index e9535360d35..39cf3f9a321 100644 --- a/src/plugins/dxf2shp_converter/dxflib/src/dl_dxf.cpp +++ b/src/plugins/dxf2shp_converter/dxflib/src/dl_dxf.cpp @@ -505,7 +505,7 @@ bool DL_Dxf::processDXFGroup( DL_CreationInterface* creationInterface, color = toInt( values[62], 256 ); char linetype[DL_DXF_MAXLINE+1]; - strcpy( linetype, toString( values[6], "BYLAYER" ) ); + strncpy( linetype, toString( values[6], "BYLAYER" ), DL_DXF_MAXLINE ); attrib = DL_Attributes( values[8], // layer color, // color diff --git a/src/plugins/topology/topolTest.cpp b/src/plugins/topology/topolTest.cpp index b061374f887..b02397f4980 100644 --- a/src/plugins/topology/topolTest.cpp +++ b/src/plugins/topology/topolTest.cpp @@ -164,6 +164,12 @@ ErrorList topolTest::checkCloseFeature( double tolerance, QgsVectorLayer* layer1 break; QgsGeometry* g1 = it->feature.geometry(); + if ( !g1 || !g1->asGeos() ) + { + badG1 = true; + continue; + } + QgsRectangle bb = g1->boundingBox(); // increase bounding box by tolerance @@ -190,13 +196,6 @@ ErrorList topolTest::checkCloseFeature( double tolerance, QgsVectorLayer* layer1 continue; } - if ( !g1 || !g1->asGeos() ) - { - badG1 = true; - continue; - - } - if ( g1->distance( *g2 ) < tolerance ) { QgsRectangle r = g2->boundingBox(); diff --git a/src/providers/spatialite/qgsspatialitedataitems.cpp b/src/providers/spatialite/qgsspatialitedataitems.cpp index b31c291827a..d908b82efb0 100644 --- a/src/providers/spatialite/qgsspatialitedataitems.cpp +++ b/src/providers/spatialite/qgsspatialitedataitems.cpp @@ -143,7 +143,7 @@ bool QgsSLConnectionItem::equal( const QgsDataItem *other ) return false; } const QgsSLConnectionItem *o = dynamic_cast( other ); - return ( mPath == o->mPath && mName == o->mName ); + return o && mPath == o->mPath && mName == o->mName; } QList QgsSLConnectionItem::actions() diff --git a/src/providers/wms/qgswmssourceselect.cpp b/src/providers/wms/qgswmssourceselect.cpp index cfc749d88b4..17b4a758f23 100644 --- a/src/providers/wms/qgswmssourceselect.cpp +++ b/src/providers/wms/qgswmssourceselect.cpp @@ -523,7 +523,8 @@ void QgsWMSSourceSelect::addClicked() } } - Q_ASSERT( layer ); + if ( !layer ) + return; if ( !layer->dimensions.isEmpty() ) { diff --git a/tests/src/core/testqgsgeometryimport.cpp b/tests/src/core/testqgsgeometryimport.cpp index 880c5743fde..8799ab8ae0e 100644 --- a/tests/src/core/testqgsgeometryimport.cpp +++ b/tests/src/core/testqgsgeometryimport.cpp @@ -147,12 +147,11 @@ void TestQgsGeometryImport::linestringWkt() QFETCH( QString, wktString ); QFETCH( QVariantList, line ); - QgsGeometry* geom = QgsGeometry::fromWkt( wktString ); + QSharedPointer geom( QgsGeometry::fromWkt( wktString ) ); QCOMPARE( geom->wkbType(), QGis::WKBLineString ); QgsPolyline polyLine = geom->asPolyline(); QVERIFY( compareLineStrings( polyLine, line ) ); - delete geom; } void TestQgsGeometryImport::linestringWkb_data() diff --git a/tests/src/core/testqgsmaplayerstylemanager.cpp b/tests/src/core/testqgsmaplayerstylemanager.cpp index ef6bdbc0485..4451acccb4d 100644 --- a/tests/src/core/testqgsmaplayerstylemanager.cpp +++ b/tests/src/core/testqgsmaplayerstylemanager.cpp @@ -60,14 +60,11 @@ void TestQgsMapLayerStyleManager::testDefault() void TestQgsMapLayerStyleManager::testStyle() { - QgsLineSymbolV2* sym1 = new QgsLineSymbolV2(); - sym1->setColor( Qt::magenta ); - QgsLineSymbolV2* sym2 = new QgsLineSymbolV2(); - sym2->setColor( Qt::red ); - QgsMapLayerStyle st; QCOMPARE( st.isValid(), false ); + QgsLineSymbolV2* sym1 = new QgsLineSymbolV2(); + sym1->setColor( Qt::magenta ); mVL->setRendererV2( new QgsSingleSymbolRendererV2( sym1 ) ); QgsMapLayerStyle st1; @@ -76,6 +73,8 @@ void TestQgsMapLayerStyleManager::testStyle() qDebug( "CNT-1: %s", st1.xmlData().toAscii().data() ); + QgsLineSymbolV2* sym2 = new QgsLineSymbolV2(); + sym2->setColor( Qt::red ); mVL->setRendererV2( new QgsSingleSymbolRendererV2( sym2 ) ); QgsMapLayerStyle st2; diff --git a/tests/src/core/testqgsvectorlayer.cpp b/tests/src/core/testqgsvectorlayer.cpp index 7d325f99c0e..ed50c403778 100644 --- a/tests/src/core/testqgsvectorlayer.cpp +++ b/tests/src/core/testqgsvectorlayer.cpp @@ -166,8 +166,8 @@ class TestQgsVectorLayer : public QObject QgsApplication::exitQgis(); } - void init() {};// will be called before each testfunction is executed. - void cleanup() {};// will be called after every testfunction. + void init() {} // will be called before each testfunction is executed. + void cleanup() {} // will be called after every testfunction. void QgsVectorLayerNonSpatialIterator() { @@ -182,428 +182,114 @@ class TestQgsVectorLayer : public QObject myCount++; } QVERIFY( myCount == 3 ); - }; + } + + void QgsVectorLayerstorageType() {} + void QgsVectorLayercapabilitiesString() {} + void QgsVectorLayerdataComment() {} + void QgsVectorLayerproviderType() {} + void QgsVectorLayersetDisplayField() {} + void QgsVectorLayerdrawLabels() {} + void QgsVectorLayerdrawLineString() {} + void QgsVectorLayerdrawPolygon() {} + void QgsVectorLayerdrawRendererV2() {} + void QgsVectorLayerdrawRendererV2Levels() {} + void QgsVectorLayerreload() {} + void QgsVectorLayerdraw() {} + void QgsVectorLayerdeleteCachedGeometries() {} + void QgsVectorLayerdrawVertexMarker() {} + void QgsVectorLayerselect() {} + void QgsVectorLayerinvertSelection() {} + void QgsVectorLayerinvertSelectionInRectangle() {} + void QgsVectorLayerremoveSelection() {} + void QgsVectorLayertriggerRepaint() {} + void QgsVectorLayerdataProvider() {} + void QgsVectorLayersetProviderEncoding() {} + void QgsVectorLayerrenderer() {} + void QgsVectorLayersetRenderer() {} + void QgsVectorLayergeometryType() {} + void QgsVectorLayerwkbType() {} + void QgsVectorLayerboundingBoxOfSelected() {} + void QgsVectorLayerfeatureCount() {} + void QgsVectorLayerupdateFeatureCount() {} + void QgsVectorLayerupdateExtents() {} + void QgsVectorLayersubsetString() {} + void QgsVectorLayersetSubsetString() {} + void QgsVectorLayerupdateFeatureAttributes() {} + void QgsVectorLayerupdateFeatureGeometry() {} + void QgsVectorLayernextFeature() {} + void QgsVectorLayerfeatureAtId() {} + void QgsVectorLayeraddFeature() {} + void QgsVectorLayerinsertVertex() {} + void QgsVectorLayermoveVertex() {} + void QgsVectorLayerdeleteVertex() {} + void QgsVectorLayerdeleteSelectedFeatures() {} + void QgsVectorLayeraddRing() {} + void QgsVectorLayeraddIsland() {} + void QgsVectorLayertranslateFeature() {} + void QgsVectorLayersplitFeatures() {} + void QgsVectorLayerremovePolygonIntersections() {} + void QgsVectorLayeraddTopologicalPoints() {} + void QgsVectorLayerlabel() {} + void QgsVectorLayerenableLabels() {} + void QgsVectorLayerhasLabelsEnabled() {} + void QgsVectorLayerstartEditing() {} + void QgsVectorLayerreadXml() {} + void QgsVectorLayersetDataProvider() {} + void QgsVectorLayerwriteXml() {} + void QgsVectorLayerreadSymbology() {} + void QgsVectorLayerwriteSymbology() {} + void QgsVectorLayerchangeGeometry() {} + void QgsVectorLayerchangeAttributeValue() {} + void QgsVectorLayeraddAttribute() {} + void QgsVectorLayeraddAttributeAlias() {} + void QgsVectorLayerattributeAlias() {} + void QgsVectorLayerattributeDisplayName() {} + void QgsVectorLayerdeleteAttribute() {} + void QgsVectorLayerdeleteFeature() {} + void QgsVectorLayerpendingFields() {} + void QgsVectorLayerpendingAllAttributesList() {} + void QgsVectorLayerpendingFeatureCount() {} + void QgsVectorLayercommitChanges() {} + void QgsVectorLayercommitErrors() {} + void QgsVectorLayerrollBack() {} + void QgsVectorLayersetSelectedFeatures() {} + void QgsVectorLayerselectedFeatureCount() {} + void QgsVectorLayerselectedFeaturesIds() {} + void QgsVectorLayerselectedFeatures() {} + void QgsVectorLayeraddFeatures() {} + void QgsVectorLayercopySymbologySettings() {} + void QgsVectorLayerhasCompatibleSymbology() {} + void QgsVectorLayersnapPoint() {} + void QgsVectorLayersnapWithContext() {} + void QgsVectorLayersnapToGeometry() {} + void QgsVectorLayerinsertSegmentVerticesForSnap() {} + void QgsVectorLayerboundingBoxFromPointList() {} + void QgsVectorLayercurrentVertexMarkerType() {} + void QgsVectorLayercurrentVertexMarkerSize() {} + void QgsVectorLayerdrawFeature() {} + void QgsVectorLayersetCoordinateSystem() {} + void QgsVectorLayertransformPoint() {} + void QgsVectorLayertransformPoints() {} + void QgsVectorLayerdisplayField() {} + void QgsVectorLayerisEditable() {} + void QgsVectorLayerisModified() {} + void QgsVectorLayersetModified() {} + void QgsVectorLayereditType() {} + void QgsVectorLayersetEditType() {} + void QgsVectorLayereditForm() {} + void QgsVectorLayersetEditForm() {} + void QgsVectorLayersetAnnotationForm() {} + void QgsVectorLayereditFormInit() {} + void QgsVectorLayersetEditFormInit() {} + void QgsVectorLayervalueMap() {} + void QgsVectorLayerrange() {} + void QgsVectorLayeraddOverlay() {} + void QgsVectorLayerremoveOverlay() {} + void QgsVectorLayervectorOverlays() {} + void QgsVectorLayerfindOverlayByType() {} + void QgsVectorLayerrendererV2() {} - void QgsVectorLayerstorageType() - { - - }; - void QgsVectorLayercapabilitiesString() - { - - }; - void QgsVectorLayerdataComment() - { - - }; - void QgsVectorLayerproviderType() - { - - }; - void QgsVectorLayersetDisplayField() - { - - }; - void QgsVectorLayerdrawLabels() - { - - }; - void QgsVectorLayerdrawLineString() - { - - }; - void QgsVectorLayerdrawPolygon() - { - - }; - void QgsVectorLayerdrawRendererV2() - { - - }; - void QgsVectorLayerdrawRendererV2Levels() - { - - }; - void QgsVectorLayerreload() - { - - }; - void QgsVectorLayerdraw() - { - - }; - void QgsVectorLayerdeleteCachedGeometries() - { - - }; - void QgsVectorLayerdrawVertexMarker() - { - - }; - void QgsVectorLayerselect() - { - - }; - void QgsVectorLayerinvertSelection() - { - - }; - void QgsVectorLayerinvertSelectionInRectangle() - { - - }; - void QgsVectorLayerremoveSelection() - { - - }; - void QgsVectorLayertriggerRepaint() - { - - }; - void QgsVectorLayerdataProvider() - { - - }; - void QgsVectorLayersetProviderEncoding() - { - - }; - void QgsVectorLayerrenderer() - { - - }; - void QgsVectorLayersetRenderer() - { - - }; - void QgsVectorLayergeometryType() - { - - }; - void QgsVectorLayerwkbType() - { - - }; - void QgsVectorLayerboundingBoxOfSelected() - { - - }; - void QgsVectorLayerfeatureCount() - { - - }; - void QgsVectorLayerupdateFeatureCount() - { - - }; - void QgsVectorLayerupdateExtents() - { - - }; - void QgsVectorLayersubsetString() - { - - }; - void QgsVectorLayersetSubsetString() - { - - }; - void QgsVectorLayerupdateFeatureAttributes() - { - - }; - void QgsVectorLayerupdateFeatureGeometry() - { - - }; - void QgsVectorLayernextFeature() - { - - }; - void QgsVectorLayerfeatureAtId() - { - - }; - void QgsVectorLayeraddFeature() - { - - }; - void QgsVectorLayerinsertVertex() - { - - }; - void QgsVectorLayermoveVertex() - { - - }; - void QgsVectorLayerdeleteVertex() - { - - }; - void QgsVectorLayerdeleteSelectedFeatures() - { - - }; - void QgsVectorLayeraddRing() - { - - }; - void QgsVectorLayeraddIsland() - { - - }; - void QgsVectorLayertranslateFeature() - { - - }; - void QgsVectorLayersplitFeatures() - { - - }; - void QgsVectorLayerremovePolygonIntersections() - { - - }; - void QgsVectorLayeraddTopologicalPoints() - { - - }; - void QgsVectorLayerlabel() - { - - }; - void QgsVectorLayerenableLabels() - { - - }; - void QgsVectorLayerhasLabelsEnabled() - { - - }; - void QgsVectorLayerstartEditing() - { - - }; - void QgsVectorLayerreadXml() - { - - }; - void QgsVectorLayersetDataProvider() - { - - }; - void QgsVectorLayerwriteXml() - { - - }; - void QgsVectorLayerreadSymbology() - { - - }; - void QgsVectorLayerwriteSymbology() - { - - }; - void QgsVectorLayerchangeGeometry() - { - - }; - void QgsVectorLayerchangeAttributeValue() - { - - }; - void QgsVectorLayeraddAttribute() - { - - }; - void QgsVectorLayeraddAttributeAlias() - { - - }; - void QgsVectorLayerattributeAlias() - { - - }; - void QgsVectorLayerattributeDisplayName() - { - - }; - void QgsVectorLayerdeleteAttribute() - { - - }; - void QgsVectorLayerdeleteFeature() - { - - }; - void QgsVectorLayerpendingFields() - { - - }; - void QgsVectorLayerpendingAllAttributesList() - { - - }; - void QgsVectorLayerpendingFeatureCount() - { - - }; - void QgsVectorLayercommitChanges() - { - - }; - void QgsVectorLayercommitErrors() - { - - }; - void QgsVectorLayerrollBack() - { - - }; - void QgsVectorLayersetSelectedFeatures() - { - - }; - void QgsVectorLayerselectedFeatureCount() - { - - }; - void QgsVectorLayerselectedFeaturesIds() - { - - }; - void QgsVectorLayerselectedFeatures() - { - - }; - void QgsVectorLayeraddFeatures() - { - - }; - void QgsVectorLayercopySymbologySettings() - { - - }; - void QgsVectorLayerhasCompatibleSymbology() - { - - }; - void QgsVectorLayersnapPoint() - { - - }; - void QgsVectorLayersnapWithContext() - { - - }; - void QgsVectorLayersnapToGeometry() - { - - }; - void QgsVectorLayerinsertSegmentVerticesForSnap() - { - - }; - void QgsVectorLayerboundingBoxFromPointList() - { - - }; - void QgsVectorLayercurrentVertexMarkerType() - { - - }; - void QgsVectorLayercurrentVertexMarkerSize() - { - - }; - void QgsVectorLayerdrawFeature() - { - - }; - void QgsVectorLayersetCoordinateSystem() - { - - }; - void QgsVectorLayertransformPoint() - { - - }; - void QgsVectorLayertransformPoints() - { - - }; - void QgsVectorLayerdisplayField() - { - - }; - void QgsVectorLayerisEditable() - { - - }; - void QgsVectorLayerisModified() - { - - }; - void QgsVectorLayersetModified() - { - - }; - void QgsVectorLayereditType() - { - - }; - void QgsVectorLayersetEditType() - { - - }; - void QgsVectorLayereditForm() - { - - }; - void QgsVectorLayersetEditForm() - { - - }; - void QgsVectorLayersetAnnotationForm() - { - - }; - void QgsVectorLayereditFormInit() - { - - }; - void QgsVectorLayersetEditFormInit() - { - - }; - void QgsVectorLayervalueMap() - { - - }; - void QgsVectorLayerrange() - { - - }; - void QgsVectorLayeraddOverlay() - { - - }; - void QgsVectorLayerremoveOverlay() - { - - }; - void QgsVectorLayervectorOverlays() - { - - }; - void QgsVectorLayerfindOverlayByType() - { - - }; - void QgsVectorLayerrendererV2() - { - - }; void QgsVectorLayersetRendererV2() { QgsVectorLayer* vLayer = static_cast< QgsVectorLayer * >( mpPointsLayer ); @@ -616,70 +302,27 @@ class TestQgsVectorLayer : public QObject vLayer->setRendererV2( symbolRenderer ); QCOMPARE( receiver.rendererChanged, true ); QCOMPARE( vLayer->rendererV2(), symbolRenderer ); - }; - void QgsVectorLayerisUsingRendererV2() - { - }; - void QgsVectorLayersetUsingRendererV2() - { + } - }; - void QgsVectorLayereditGeometryChange() - { - - }; - void QgsVectorLayereditFeatureAdd() - { - - }; - void QgsVectorLayereditFeatureDelete() - { - - }; - void QgsVectorLayereditAttributeChange() - { - - }; - void QgsVectorLayerbeginEditCommand() - { - - }; - void QgsVectorLayerendEditCommand() - { - - }; - void QgsVectorLayerdestroyEditCommand() - { - - }; - void QgsVectorLayerredoEditCommand() - { - - }; - void QgsVectorLayerundoEditCommand() - { - - }; - void QgsVectorLayersetCheckedState() - { - - }; - void QgsVectorLayercheckedState() - { - - }; - void QgsVectorLayerfieldNameIndex() - { - - }; - void QgsVectorLayerstopRendererV2() - { - - }; + void QgsVectorLayerisUsingRendererV2() {} + void QgsVectorLayersetUsingRendererV2() {} + void QgsVectorLayereditGeometryChange() {} + void QgsVectorLayereditFeatureAdd() {} + void QgsVectorLayereditFeatureDelete() {} + void QgsVectorLayereditAttributeChange() {} + void QgsVectorLayerbeginEditCommand() {} + void QgsVectorLayerendEditCommand() {} + void QgsVectorLayerdestroyEditCommand() {} + void QgsVectorLayerredoEditCommand() {} + void QgsVectorLayerundoEditCommand() {} + void QgsVectorLayersetCheckedState() {} + void QgsVectorLayercheckedState() {} + void QgsVectorLayerfieldNameIndex() {} + void QgsVectorLayerstopRendererV2() {} void QgsVectorLayersetFeatureBlendMode() { - QgsVectorLayer* vLayer = static_cast< QgsVectorLayer * >( mpPointsLayer ); + QgsVectorLayer *vLayer = static_cast< QgsVectorLayer * >( mpPointsLayer ); TestSignalReceiver receiver; QObject::connect( vLayer, SIGNAL( featureBlendModeChanged( const QPainter::CompositionMode ) ), &receiver, SLOT( onFeatureBlendModeChanged( const QPainter::CompositionMode ) ) ); diff --git a/tests/src/core/testziplayer.cpp b/tests/src/core/testziplayer.cpp index 3d14c7a1a51..2968554b181 100644 --- a/tests/src/core/testziplayer.cpp +++ b/tests/src/core/testziplayer.cpp @@ -214,7 +214,7 @@ bool TestZipLayer::testZipItem( QString myFileName, QString myChildName, QString } else { - QWARN( QString( "Invalid layer %1" ).arg( layerItem->path() ).toLocal8Bit().data() ); + QWARN( QString( "Invalid layer %1" ).arg( layerItem ? layerItem->path() : "(null)" ).toLocal8Bit().data() ); break; } }