Skip to content
Permalink
Browse files

coverity fixes

  • Loading branch information
jef-n committed Feb 18, 2015
1 parent fc22bf1 commit 1e97b62cf962a5b4ae8cc7507ca42a881e6b57e1
Showing with 17 additions and 11 deletions.
  1. +3 −1 src/app/main.cpp
  2. +6 −2 src/providers/wms/qgswmsprovider.cpp
  3. +2 −2 src/server/qgswfsserver.cpp
  4. +6 −6 src/server/qgswmsserver.cpp
@@ -226,8 +226,10 @@ static void dumpBacktrace( unsigned int depth )
{
int status;
close( STDERR_FILENO );
if ( dup( stderr_fd ) != STDERR_FILENO )
int dup_stderr = dup( stderr_fd );
if ( dup_stderr != STDERR_FILENO )
{
close( dup_stderr );
QgsDebugMsg( "dup to stderr failed" );
}
close( stderr_fd );
@@ -486,7 +486,7 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, in
mCachedViewWidth = pixelWidth;
mCachedViewHeight = pixelHeight;

if ( !mSettings.mTiled && !mSettings.mMaxWidth && !mSettings.mMaxHeight )
if ( !mSettings.mTiled && mSettings.mMaxWidth == 0 && mSettings.mMaxHeight == 0 )
{
// Calculate active layers that are also visible.

@@ -559,7 +559,7 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, in
//t.start();

}
else
else if ( mSettings.mMaxWidth != 0 && mSettings.mMaxHeight != 0 )
{
mTileReqNo++;

@@ -831,6 +831,10 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, in
);
#endif
}
else
{
QgsDebugMsg( "empty tile size" );
}

return mCachedImage;
}
@@ -1356,7 +1356,7 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )
// Store the created feature id for WFS
QStringList insertResults;
// Get the WFS layers id
QStringList wfsLayersId = mConfigParser->wfsLayers();
QStringList wfsLayersId = mConfigParser ? mConfigParser->wfsLayers() : QStringList();

QList<QgsMapLayer*> layerList;
QgsMapLayer* currentLayer = 0;
@@ -1373,7 +1373,7 @@ QDomDocument QgsWFSServer::transaction( const QString& requestBody )
currentLayer = layerList.at( 0 );

QgsVectorLayer* layer = qobject_cast<QgsVectorLayer*>( currentLayer );
// it's a vectorlayer and definy by the administrator as a WFS layer
// it's a vectorlayer and defined by the administrator as a WFS layer
if ( layer && wfsLayersId.contains( layer->id() ) )
{
// Get the provider and it's capabilities
@@ -1517,7 +1517,7 @@ int QgsWMSServer::getFeatureInfo( QDomDocument& result, QString version )
else
{
layerElement = result.createElement( "Layer" );
QString layerName = mConfigParser->useLayerIDs() ? currentLayer->id() : currentLayer->name();
QString layerName = mConfigParser && mConfigParser->useLayerIDs() ? currentLayer->id() : currentLayer->name();

//check if the layer is given a different name for GetFeatureInfo output
QHash<QString, QString>::const_iterator layerAliasIt = layerAliasMap.find( layerName );
@@ -2068,7 +2068,7 @@ int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer,
{
bool withGeom = layer->wkbType() != QGis::WKBNoGeometry && addWktGeometry;
int version = infoFormat.startsWith( "application/vnd.ogc.gml/3" ) ? 3 : 2;
QDomElement elem = createFeatureGML( &feature, layer, infoDocument, outputCrs, mConfigParser->useLayerIDs() ? layer->id() : layer->name(), withGeom, version );
QDomElement elem = createFeatureGML( &feature, layer, infoDocument, outputCrs, mConfigParser && mConfigParser->useLayerIDs() ? layer->id() : layer->name(), withGeom, version );
QDomElement featureMemberElem = infoDocument.createElement( "gml:featureMember"/*wfs:FeatureMember*/ );
featureMemberElem.appendChild( elem );
layerElement.appendChild( featureMemberElem );
@@ -2202,7 +2202,7 @@ int QgsWMSServer::featureInfoFromRasterLayer( QgsRasterLayer* layer,

QgsCoordinateReferenceSystem layerCrs = layer->crs();
int version = infoFormat.startsWith( "application/vnd.ogc.gml/3" ) ? 3 : 2;
QDomElement elem = createFeatureGML( &feature, 0, infoDocument, layerCrs, mConfigParser->useLayerIDs() ? layer->id() : layer->name(), false, version );
QDomElement elem = createFeatureGML( &feature, 0, infoDocument, layerCrs, mConfigParser && mConfigParser->useLayerIDs() ? layer->id() : layer->name(), false, version );
layerElement.appendChild( elem );
}
else
@@ -2254,7 +2254,7 @@ QStringList QgsWMSServer::layerSet( const QStringList &layersList,
theMapLayer = layerList.at( listIndex );
if ( theMapLayer )
{
QgsDebugMsg( QString( "Checking layer: %1" ).arg( mConfigParser->useLayerIDs() ? theMapLayer->id() : theMapLayer->name() ) );
QgsDebugMsg( QString( "Checking layer: %1" ).arg( mConfigParser && mConfigParser->useLayerIDs() ? theMapLayer->id() : theMapLayer->name() ) );
//test if layer is visible in requested scale
bool useScaleConstraint = ( scaleDenominator > 0 && theMapLayer->hasScaleBasedVisibility() );
if ( !useScaleConstraint ||
@@ -2317,7 +2317,7 @@ QMap<QString, QString> QgsWMSServer::applyRequestedLayerFilters( const QStringLi

foreach ( QgsMapLayer *layer, QgsMapLayerRegistry::instance()->mapLayers() )
{
if ( layer && ( mConfigParser->useLayerIDs() ? layer->id() : layer->name() ) == eqSplit.at( 0 ) )
if ( layer && ( mConfigParser && mConfigParser->useLayerIDs() ? layer->id() : layer->name() ) == eqSplit.at( 0 ) )
{
layersToFilter.push_back( layer );
}
@@ -2542,7 +2542,7 @@ QStringList QgsWMSServer::applyFeatureSelections( const QStringList& layerList )

foreach ( QgsMapLayer *layer, QgsMapLayerRegistry::instance()->mapLayers() )
{
if ( layer && ( mConfigParser->useLayerIDs() ? layer->id() : layer->name() ) == layerName )
if ( layer && ( mConfigParser && mConfigParser->useLayerIDs() ? layer->id() : layer->name() ) == layerName )
{
vLayer = qobject_cast<QgsVectorLayer*>( layer );
layersWithSelections.push_back( vLayer->id() );

0 comments on commit 1e97b62

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