Skip to content
Permalink
Browse files

Coverity fixes

  • Loading branch information
nyalldawson committed Feb 11, 2015
1 parent 8e4368c commit f601f9277aa98900c6b69e7242f8f0bb4557082a
@@ -94,6 +94,8 @@ class QwtPolarLayout::PrivateData
{
public:
PrivateData():
legendPos( QwtPolarPlot::LeftLegend ),
legendRatio( 0.5 ),
margin( 0 ),
spacing( 0 )
{
@@ -41,6 +41,12 @@ class QwtPolarPlot::ScaleData
{
public:
ScaleData():
doAutoScale( false ),
minValue( 0.0 ),
maxValue( 0.0 ),
stepSize( 0.0 ),
maxMajor( 0 ),
maxMinor( 0 ),
scaleEngine( NULL )
{
}
@@ -91,7 +91,7 @@ QMenu* QgsAppLayerTreeViewMenuProvider::createContextMenu()
menu->addAction( QgsApplication::getThemeIcon( "/mActionSetProjectCRS.png" ), tr( "Set &Project CRS from Layer" ), QgisApp::instance(), SLOT( setProjectCRSFromLayer() ) );

// style-related actions
if ( mView->selectedLayerNodes().count() == 1 )
if ( layer && mView->selectedLayerNodes().count() == 1 )
{
QMenu* menuStyleManager = new QMenu( tr( "Styles" ) );

@@ -176,7 +176,8 @@ void QgsMapToolMoveLabel::canvasReleaseEvent( QMouseEvent * e )
}
vlayer->endEditCommand();

mCanvas->refresh();
if ( mCanvas )
mCanvas->refresh();
}


@@ -839,6 +839,10 @@ void QgsDxfExport::writeEntities()

QgsSymbolV2RenderContext sctx( ctx, QgsSymbolV2::MM, 1.0, false, 0, 0 );
QgsFeatureRendererV2* renderer = vl->rendererV2();
if ( !renderer )
{
continue;
}
renderer->startRender( ctx, vl->pendingFields() );

QStringList attributes = renderer->usedAttributes();
@@ -879,10 +883,6 @@ void QgsDxfExport::writeEntities()
}
else
{
if ( !renderer )
{
continue;
}
QgsSymbolV2List symbolList = renderer->symbolsForFeature( fet );
if ( symbolList.size() < 1 )
{
@@ -936,7 +936,8 @@ void QgsDxfExport::writeEntitiesSymbolLevels( QgsVectorLayer* layer )
QgsFeatureRendererV2* renderer = layer->rendererV2();
if ( !renderer )
{
//return error
//TODO return error
return;
}
QHash< QgsSymbolV2*, QList<QgsFeature> > features;

@@ -656,7 +656,7 @@ class CORE_EXPORT QgsExpression
/**
* Used by QgsOgcUtils to create an empty
*/
QgsExpression() : mRootNode( 0 ), mRowNumber( 0 ), mCalc( 0 ) {}
QgsExpression() : mRootNode( 0 ), mRowNumber( 0 ), mScale( 0.0 ), mCalc( 0 ) {}

void initGeomCalculator();

@@ -379,12 +379,6 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
/** Encoding */
QTextCodec* mEncoding;

/** should provider fetch also features that don't have geometry? */
bool mFetchFeaturesWithoutGeom;

/** True if geometry should be added to the features in nextFeature calls*/
bool mFetchGeom;

/** List of attribute indices to fetch with nextFeature calls*/
QgsAttributeList mAttributesToFetch;

@@ -842,7 +842,7 @@ QgsRectangle QgsVectorLayer::extent()
QgsDebugMsg( "invoked with null mDataProvider" );
}

if ( mEditBuffer && mEditBuffer->mDeletedFeatureIds.isEmpty() && mEditBuffer->mChangedGeometries.isEmpty() )
if ( mDataProvider && mEditBuffer && mEditBuffer->mDeletedFeatureIds.isEmpty() && mEditBuffer->mChangedGeometries.isEmpty() )
{
mDataProvider->updateExtents();

@@ -534,7 +534,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer

struct ValueRelationData
{
ValueRelationData() {}
ValueRelationData() : mAllowNull( false ), mOrderByValue( false ), mAllowMulti( false ) {}
ValueRelationData( QString layer, QString key, QString value, bool allowNull, bool orderByValue,
bool allowMulti = false,
QString filterExpression = QString::null )
@@ -82,14 +82,50 @@ QgsRasterProjector::QgsRasterProjector(
, mSrcDatumTransform( -1 )
, mDestDatumTransform( -1 )
, mExtent( theExtent )
, mDestRows( 0 )
, mDestCols( 0 )
, mDestXRes( 0.0 )
, mDestYRes( 0.0 )
, mSrcRows( 0 )
, mSrcCols( 0 )
, mSrcXRes( 0.0 )
, mSrcYRes( 0.0 )
, mDestRowsPerMatrixRow( 0.0 )
, mDestColsPerMatrixCol( 0.0 )
, pHelperTop( 0 ), pHelperBottom( 0 )
, mMaxSrcXRes( theMaxSrcXRes ), mMaxSrcYRes( theMaxSrcYRes )
, mCPCols( 0 )
, mCPRows( 0 )
, mSqrTolerance( 0.0 )
, mMaxSrcXRes( theMaxSrcXRes )
, mMaxSrcYRes( theMaxSrcYRes )
, mApproximate( false )
{
QgsDebugMsg( "Entered" );
}

QgsRasterProjector::QgsRasterProjector()
: QgsRasterInterface( 0 ), mSrcDatumTransform( -1 ), mDestDatumTransform( -1 ), pHelperTop( 0 ), pHelperBottom( 0 )
: QgsRasterInterface( 0 )
, mSrcDatumTransform( -1 )
, mDestDatumTransform( -1 )
, mDestRows( 0 )
, mDestCols( 0 )
, mDestXRes( 0.0 )
, mDestYRes( 0.0 )
, mSrcRows( 0 )
, mSrcCols( 0 )
, mSrcXRes( 0.0 )
, mSrcYRes( 0.0 )
, mDestRowsPerMatrixRow( 0.0 )
, mDestColsPerMatrixCol( 0.0 )
, pHelperTop( 0 )
, pHelperBottom( 0 )
, mHelperTopRow( 0 )
, mCPCols( 0 )
, mCPRows( 0 )
, mSqrTolerance( 0.0 )
, mMaxSrcXRes( 0 )
, mMaxSrcYRes( 0 )
, mApproximate( false )
{
QgsDebugMsg( "Entered" );
}
@@ -1692,8 +1692,10 @@ void QgsCptCityBrowserModel::fetchMore( const QModelIndex & parent )
{
QgsCptCityDataItem* item = dataItem( parent );
if ( item )
{
item->populate();
QgsDebugMsg( "path = " + item->path() );
QgsDebugMsg( "path = " + item->path() );
}
}


@@ -1352,7 +1352,7 @@ void QgsMarkerLineSymbolLayerV2::toSld( QDomDocument &doc, QDomElement &element,
QgsMarkerSymbolLayerV2 *markerLayer = static_cast<QgsMarkerSymbolLayerV2 *>( layer );
if ( !markerLayer )
{
graphicStrokeElem.appendChild( doc.createComment( QString( "MarkerSymbolLayerV2 expected, %1 found. Skip it." ).arg( markerLayer->layerType() ) ) );
graphicStrokeElem.appendChild( doc.createComment( QString( "MarkerSymbolLayerV2 expected, %1 found. Skip it." ).arg( layer->layerType() ) ) );
}
else
{
@@ -844,7 +844,7 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
//outlineWidth
double outlineWidth = mOutlineWidth;
QgsExpression* outlineWidthExpression = expression( "outline_width" );
if ( outlineWidthExpression )
if ( context && outlineWidthExpression )
{
outlineWidth = outlineWidthExpression->evaluate( const_cast<QgsFeature*>( context->feature() ) ).toDouble();
}
@@ -872,13 +872,16 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
//offset
double offsetX = 0;
double offsetY = 0;
markerOffset( *context, offsetX, offsetY );
if ( context )
{
markerOffset( *context, offsetX, offsetY );
}
QPointF off( offsetX, offsetY );

//angle
double angle = mAngle;
QgsExpression* angleExpression = expression( "angle" );
if ( angleExpression )
if ( context && angleExpression )
{
angle = angleExpression->evaluate( const_cast<QgsFeature*>( context->feature() ) ).toDouble();
}
@@ -1256,7 +1259,6 @@ QString QgsSvgMarkerSymbolLayerV2::layerType() const
void QgsSvgMarkerSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context )
{
QgsMarkerSymbolLayerV2::startRender( context ); // get anchor point expressions
mOrigSize = mSize; // save in case the size would be data defined
Q_UNUSED( context );
prepareExpressions( context.fields(), context.renderContext().rendererScale() );
}
@@ -1655,6 +1657,7 @@ QgsFontMarkerSymbolLayerV2::QgsFontMarkerSymbolLayerV2( QString fontFamily, QCha
mColor = color;
mAngle = angle;
mSize = pointSize;
mOrigSize = pointSize;
mSizeUnit = QgsSymbolV2::MM;
mOffset = QPointF( 0, 0 );
mOffsetUnit = QgsSymbolV2::MM;
@@ -211,7 +211,6 @@ class CORE_EXPORT QgsSvgMarkerSymbolLayerV2 : public QgsMarkerSymbolLayerV2
double mOutlineWidth;
QgsSymbolV2::OutputUnit mOutlineWidthUnit;
QgsMapUnitScale mOutlineWidthMapUnitScale;
double mOrigSize;
};


@@ -94,11 +94,7 @@ class GUI_EXPORT QgsAttributeTypeLoadDialog: public QDialog, private Ui::QgsAttr
void loadDataToValueMap();

QgsVectorLayer *mLayer;
int mIndex;


QMap<QString, QVariant> mValueMap;
QgsVectorLayer::EditType mEditType;
};

#endif
@@ -88,7 +88,7 @@ QgsRasterLayerSaveAsDialog::QgsRasterLayerSaveAsDialog( QgsRasterLayer* rasterLa
}

// Only do pyramids if dealing directly with GDAL.
if ( mDataProvider->capabilities() & QgsRasterDataProvider::BuildPyramids )
if ( mDataProvider && mDataProvider->capabilities() & QgsRasterDataProvider::BuildPyramids )
{
// setup pyramids option widget
// mPyramidsOptionsWidget->createOptionsWidget()->setType( QgsRasterFormatSaveOptionsWidget::ProfileLineEdit );
@@ -71,7 +71,7 @@ QgsEllipseSymbolLayerV2Widget::QgsEllipseSymbolLayerV2Widget( const QgsVectorLay

void QgsEllipseSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
{
if ( layer->layerType() != "EllipseMarker" )
if ( layer && layer->layerType() != "EllipseMarker" )
{
return;
}
@@ -93,8 +93,6 @@ void QgsEllipseSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )

//set combo entries to current values
blockComboSignals( true );
if ( mLayer )
{
mSymbolWidthUnitWidget->setUnit( mLayer->symbolWidthUnit() );
mSymbolWidthUnitWidget->setMapUnitScale( mLayer->symbolWidthMapUnitScale() );
mOutlineWidthUnitWidget->setUnit( mLayer->outlineWidthUnit() );
@@ -103,13 +101,11 @@ void QgsEllipseSymbolLayerV2Widget::setSymbolLayer( QgsSymbolLayerV2* layer )
mSymbolHeightUnitWidget->setMapUnitScale( mLayer->symbolHeightMapUnitScale() );
mOffsetUnitWidget->setUnit( mLayer->offsetUnit() );
mOffsetUnitWidget->setMapUnitScale( mLayer->offsetMapUnitScale() );
}

QPointF offsetPt = mLayer->offset();
spinOffsetX->setValue( offsetPt.x() );
spinOffsetY->setValue( offsetPt.y() );
mHorizontalAnchorComboBox->setCurrentIndex( mLayer->horizontalAnchorPoint() );
mVerticalAnchorComboBox->setCurrentIndex( mLayer->verticalAnchorPoint() );
QPointF offsetPt = mLayer->offset();
spinOffsetX->setValue( offsetPt.x() );
spinOffsetY->setValue( offsetPt.y() );
mHorizontalAnchorComboBox->setCurrentIndex( mLayer->horizontalAnchorPoint() );
mVerticalAnchorComboBox->setCurrentIndex( mLayer->verticalAnchorPoint() );
blockComboSignals( false );

registerDataDefinedButton( mSymbolWidthDDBtn, "width", QgsDataDefinedButton::Double, QgsDataDefinedButton::doublePosDesc() );
@@ -1611,6 +1611,7 @@ bool DL_Dxf::handleHatchData( DL_CreationInterface* /*creationInterface*/ )
hatchEdges != NULL &&
hatchEdgeIndex != NULL &&
hatchLoopIndex >= 0 &&
maxHatchEdges != NULL &&
hatchLoopIndex < maxHatchLoops &&
hatchEdges[hatchLoopIndex] != NULL &&
hatchEdgeIndex[hatchLoopIndex] >= 0 &&
@@ -1059,7 +1059,7 @@ void QgsSpatialQueryDialog::signal_qgis_layerWillBeRemoved( QString idLayer )
mLayerTarget = NULL;
}
}
else
else if ( mLayerTarget )
{
populateCbOperation();
}
@@ -1729,7 +1729,7 @@ QgsVectorLayerImport::ImportError QgsMssqlProvider::createEmptyLayer(
for ( int i = 0, n = fields.size(); i < n; ++i )
{
QgsField fld = fields[i];
if ( fld.name() == primaryKey )
if ( oldToNewAttrIdxMap && fld.name() == primaryKey )
{
oldToNewAttrIdxMap->insert( fields.indexFromName( fld.name() ), 0 );
continue;
@@ -37,6 +37,8 @@ class QNetworkReply;
/** CoverageSummary structure */
struct QgsWcsCoverageSummary
{
QgsWcsCoverageSummary() : orderId( 0 ), valid( false ), described( false ), width( 0 ), height( 0 ), hasSize( false ) { }

int orderId;
QString identifier;
QString title;

0 comments on commit f601f92

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