Skip to content
Permalink
Browse files

new coverity fixes

  • Loading branch information
jef-n committed Feb 8, 2015
1 parent b2cfe0b commit b67daf0336aa221eaa8551f5dfe4bfa0eb1d0ad3
Showing with 489 additions and 352 deletions.
  1. +13 −3 src/analysis/raster/qgsninecellfilter.cpp
  2. +2 −1 src/app/main.cpp
  3. +28 −5 src/app/qgisapp.cpp
  4. +155 −158 src/app/qgisapp.h
  5. +5 −5 src/core/raster/qgsrasterlayer.h
  6. +1 −0 src/gui/editorwidgets/qgsrelationreferencewidget.cpp
  7. +21 −8 src/plugins/grass/qgsgrassedit.cpp
  8. +1 −1 src/plugins/grass/qgsgrassedit.h
  9. +30 −26 src/plugins/grass/qgsgrassmapcalc.cpp
  10. +2 −2 src/plugins/grass/qgsgrassmapcalc.h
  11. +20 −4 src/plugins/grass/qgsgrassmodule.cpp
  12. +12 −12 src/plugins/grass/qgsgrassmodule.h
  13. +1 −1 src/plugins/grass/qgsgrassnewmapset.cpp
  14. +4 −1 src/plugins/grass/qgsgrassselect.cpp
  15. +4 −1 src/plugins/grass/qgsgrassshell.cpp
  16. +4 −3 src/plugins/grass/qtermwidget/History.cpp
  17. +1 −0 src/plugins/grass/qtermwidget/ScreenWindow.cpp
  18. +3 −2 src/plugins/grass/qtermwidget/Session.cpp
  19. +0 −2 src/plugins/grass/qtermwidget/Session.h
  20. +4 −2 src/plugins/grass/qtermwidget/kpty.cpp
  21. +1 −1 src/providers/grass/qgis.g.info.c
  22. +7 −0 src/providers/grass/qgsgrassprovider.cpp
  23. +1 −1 src/providers/grass/qgsgrassprovidermodule.cpp
  24. +16 −7 src/providers/grass/qgsgrassrasterprovider.cpp
  25. +14 −6 src/server/qgsconfigcache.cpp
  26. +5 −1 src/server/qgsinterpolationlayerbuilder.cpp
  27. +1 −0 src/server/qgsmslayercache.cpp
  28. +1 −0 src/server/qgsserverprojectparser.cpp
  29. +20 −13 src/server/qgssldconfigparser.cpp
  30. +1 −1 src/server/qgssldconfigparser.h
  31. +1 −1 src/server/qgssoaprequesthandler.cpp
  32. +1 −1 src/server/qgssoaprequesthandler.h
  33. +14 −14 src/server/qgswcsprojectparser.cpp
  34. +15 −7 src/server/qgswcsserver.cpp
  35. +1 −0 src/server/qgswfsprojectparser.cpp
  36. +45 −39 src/server/qgswfsserver.cpp
  37. +1 −0 src/server/qgswmsprojectparser.cpp
  38. +30 −23 src/server/qgswmsserver.cpp
  39. +3 −0 tests/src/core/testqgscomposermap.cpp
@@ -27,15 +27,25 @@
#endif

QgsNineCellFilter::QgsNineCellFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat )
: mInputFile( inputFile ), mOutputFile( outputFile ), mOutputFormat( outputFormat ), mCellSizeX( -1 ), mCellSizeY( -1 ),
mInputNodataValue( -1 ), mOutputNodataValue( -1 ), mZFactor( 1.0 )
: mInputFile( inputFile )
, mOutputFile( outputFile )
, mOutputFormat( outputFormat )
, mCellSizeX( 0 )
, mCellSizeY( 0 )
, mInputNodataValue( 0 )
, mOutputNodataValue( 0 )
, mZFactor( 1.0 )
{

}

QgsNineCellFilter::QgsNineCellFilter()
: mCellSizeX( 0 )
, mCellSizeY( 0 )
, mInputNodataValue( 0 )
, mOutputNodataValue( 0 )
, mZFactor( 1.0 )
{

}

QgsNineCellFilter::~QgsNineCellFilter()
@@ -210,7 +210,8 @@ static void dumpBacktrace( unsigned int depth )
int stderr_new = dup( fd[1] );
if ( stderr_new != STDERR_FILENO )
{
close( stderr_new );
if ( stderr_new >= 0 )
close( stderr_new );
QgsDebugMsg( "dup to stderr failed" );
}

@@ -478,15 +478,39 @@ QgisApp *QgisApp::smInstance = 0;
// constructor starts here
QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, Qt::WindowFlags fl )
: QMainWindow( parent, fl )
, mSplash( splash )
, mMousePrecisionDecimalPlaces( 0 )
, mInternalClipboard( 0 )
, mShowProjectionTab( false )
, mPythonUtils( 0 )
#ifdef Q_OS_WIN
, mSkipNextContextMenuEvent( 0 )
#endif
, mNonEditMapTool( 0 )
, mScaleLabel( 0 )
, mScaleEdit( 0 )
, mScaleEditValidator( 0 )
, mCoordsLabel( 0 )
, mCoordsEdit( 0 )
, mCoordsEditValidator( 0 )
, mRotationLabel( 0 )
, mRotationEdit( 0 )
, mRotationEditValidator( 0 )
, mProgressBar( 0 )
, mRenderSuppressionCBox( 0 )
, mOnTheFlyProjectionStatusLabel( 0 )
, mOnTheFlyProjectionStatusButton( 0 )
, mMessageButton( 0 )
, mFeatureActionMenu( 0 )
, mPopupMenu( 0 )
, mDatabaseMenu( 0 )
, mWebMenu( 0 )
, mToolPopupOverviews( 0 )
, mToolPopupDisplay( 0 )
, mLayerTreeCanvasBridge( 0 )
, mPreviousNonZoomMapTool( 0 )
, mSplash( splash )
, mInternalClipboard( 0 )
, mShowProjectionTab( false )
, mPythonUtils( 0 )
, mComposerManager( 0 )
, mpTileScaleWidget( 0 )
, mpGpsWidget( 0 )
, mSnappingUtils( 0 )
{
@@ -842,7 +866,6 @@ QgisApp::QgisApp()
, mSnappingDialog( 0 )
, mPluginManager( 0 )
, mComposerManager( 0 )
, mpTileScaleWidget( 0 )
, mLastComposerId( 0 )
, mpGpsWidget( 0 )
, mLastMapToolMessage( 0 )

Large diffs are not rendered by default.

@@ -192,8 +192,8 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
*
* -
* */
QgsRasterLayer( const QString & path,
const QString & baseName = QString::null,
QgsRasterLayer( const QString &path,
const QString &baseName = QString::null,
bool loadDefaultStyleFlag = true );

//TODO - QGIS 3.0
@@ -202,9 +202,9 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
//implicitly converted to a bool.
//for QGIS 3.0, make either constructor explicit or alter the signatures
/** \brief [ data provider interface ] Constructor in provider mode */
QgsRasterLayer( const QString & uri,
const QString & baseName,
const QString & providerKey,
QgsRasterLayer( const QString &uri,
const QString &baseName,
const QString &providerKey,
bool loadDefaultStyleFlag = true );

/** \brief The destructor */
@@ -74,6 +74,7 @@ QgsRelationReferenceWidget::QgsRelationReferenceWidget( QWidget* parent )
, mEmbedForm( false )
, mReadOnlySelector( false )
, mAllowMapIdentification( false )
, mOrderByValue( false )
, mOpenFormButtonVisible( true )
{
mTopLayout = new QVBoxLayout( this );
@@ -143,20 +143,33 @@ void QgsGrassEditAttributeTableItemDelegate::setModelData( QWidget *editor,

bool QgsGrassEdit::mRunning = false;

QgsGrassEdit::QgsGrassEdit( QgisInterface *iface, QgsMapLayer* layer, bool newMap,
QWidget * parent, Qt::WindowFlags f )
: QMainWindow( parent, f ), QgsGrassEditBase(), mInited( false ),
mMapTool( 0 ), mCanvasEdit( 0 ), mRubberBandLine( 0 ), mRubberBandIcon( 0 )
QgsGrassEdit::QgsGrassEdit( QgisInterface *iface, QgsMapLayer *layer, bool newMap,
QWidget *parent, Qt::WindowFlags f )
: QMainWindow( parent, f )
, QgsGrassEditBase()
, mValid( false )
, mInited( false )
, mIface( iface )
, mMoveVertexAction( 0 )
, mAddVertexAction( 0 )
, mDeleteVertexAction( 0 )
, mMoveLineAction( 0 )
, mSplitLineAction( 0 )
, mDeleteLineAction( 0 )
, mEditAttributesAction( 0 )
, mCloseEditAction( 0 )
, mMapTool( 0 )
, mCanvasEdit( 0 )
, mRubberBandLine( 0 )
, mRubberBandIcon( 0 )
{
QgsDebugMsg( "QgsGrassEdit()" );

setupUi( this );

mRunning = true;
mValid = false;
mTool = QgsGrassEdit::NONE;
mSuspend = false;
mIface = iface;
mNewMap = newMap;

mProjectionEnabled = ( QgsProject::instance()->readNumEntry( "SpatialRefSys", "/ProjectionsEnabled", 0 ) != 0 );
@@ -173,7 +186,6 @@ QgsGrassEdit::QgsGrassEdit( QgisInterface *iface, QgsMapLayer* layer, bool newMa
mProvider = ( QgsGrassProvider * ) mLayer->dataProvider();

init();

}

bool QgsGrassEdit::isEditable( QgsMapLayer *layer )
@@ -1531,7 +1543,8 @@ void QgsGrassEdit::addCat( int line )
delete atts;
}

addAttributes( field, cat );
if ( mAttributes )
addAttributes( field, cat );
}

void QgsGrassEdit::deleteCat( int line, int field, int cat )
@@ -444,7 +444,7 @@ class QgsGrassEdit: public QMainWindow, private Ui::QgsGrassEditBase
bool mProjectionEnabled;

// Canvas items
QgsGrassEditLayer* mCanvasEdit;
QgsGrassEditLayer *mCanvasEdit;
QgsRubberBand *mRubberBandLine;
QgsVertexMarker *mRubberBandIcon;

@@ -25,7 +25,6 @@
#include "qgsgrassplugin.h"

#include <cmath>
#include <typeinfo>

#include <QDir>
#include <QDomDocument>
@@ -280,19 +279,19 @@ void QgsGrassMapcalc::mousePressEvent( QMouseEvent* e )
{
--it;

if ( typeid( **it ) == typeid( QgsGrassMapcalcConnector ) )
if ( QgsGrassMapcalcConnector *con = dynamic_cast<QgsGrassMapcalcConnector *>( *it ) )
{
mConnector = dynamic_cast<QgsGrassMapcalcConnector *>( *it );
mConnector = con;
mConnector->setSelected( true );
mConnector->selectEnd( p );
mStartMoveConnectorPoints[0] = mConnector->point( 0 );
mStartMoveConnectorPoints[1] = mConnector->point( 1 );

break;
}
else if ( typeid( **it ) == typeid( QgsGrassMapcalcObject ) )
else if ( QgsGrassMapcalcObject *obj = dynamic_cast<QgsGrassMapcalcObject *>( *it ) )
{
mObject = dynamic_cast<QgsGrassMapcalcObject *>( *it );
mObject = obj;
mObject->setSelected( true );

int tool = Select;
@@ -991,17 +990,13 @@ void QgsGrassMapcalc::growCanvas( int left, int right, int top, int bottom )
{
--it;

if ( typeid( **it ) == typeid( QgsGrassMapcalcObject ) )
if ( QgsGrassMapcalcObject *obj = dynamic_cast<QgsGrassMapcalcObject *>( *it ) )
{
QgsGrassMapcalcObject *obj = dynamic_cast<QgsGrassMapcalcObject *>( *it );

QPoint p = obj->center();
obj->setCenter( p.x() + left, p.y() + top );
}
else if ( typeid( **it ) == typeid( QgsGrassMapcalcConnector ) )
else if ( QgsGrassMapcalcConnector *con = dynamic_cast<QgsGrassMapcalcConnector *>( *it ) )
{
QgsGrassMapcalcConnector *con = dynamic_cast<QgsGrassMapcalcConnector *>( *it );

for ( int i = 0; i < 2; i++ )
{
QPoint p = con->point( i );
@@ -1162,10 +1157,8 @@ void QgsGrassMapcalc::save()
{
--it;

if ( typeid( **it ) == typeid( QgsGrassMapcalcObject ) )
if ( QgsGrassMapcalcObject *obj = dynamic_cast<QgsGrassMapcalcObject *>( *it ) )
{
QgsGrassMapcalcObject *obj = dynamic_cast<QgsGrassMapcalcObject *>( *it );

QString type;
if ( obj->type() == QgsGrassMapcalcObject::Map )
{
@@ -1212,10 +1205,8 @@ void QgsGrassMapcalc::save()
}
stream << "/>\n";
}
else if ( typeid( **it ) == typeid( QgsGrassMapcalcConnector ) )
else if ( QgsGrassMapcalcConnector *con = dynamic_cast<QgsGrassMapcalcConnector *>( *it ) )
{
QgsGrassMapcalcConnector *con = dynamic_cast<QgsGrassMapcalcConnector *>( *it );

stream << " <connector id=\"" + QString::number( con->id() )
+ "\">\n";

@@ -1914,7 +1905,9 @@ QString QgsGrassMapcalcObject::expression()

/************************* CONNECTOR **********************************/
QgsGrassMapcalcConnector::QgsGrassMapcalcConnector( QGraphicsScene *canvas )
: QGraphicsLineItem(), QgsGrassMapcalcItem()
: QGraphicsLineItem()
, QgsGrassMapcalcItem()
, mSelectedEnd( -1 )
{
QgsDebugMsg( "entered." );

@@ -2042,11 +2035,8 @@ bool QgsGrassMapcalcConnector::tryConnectEnd( int end )
{
--it;

if ( typeid( **it ) == typeid( QgsGrassMapcalcObject ) )
{
object = dynamic_cast<QgsGrassMapcalcObject *>( *it );
if (( object = dynamic_cast<QgsGrassMapcalcObject *>( *it ) ) )
break;
}
}

// try to connect
@@ -2117,10 +2107,13 @@ QgsGrassMapcalcObject *QgsGrassMapcalcConnector::object( int end )
/************************* FUNCTION *****************************/
QgsGrassMapcalcFunction::QgsGrassMapcalcFunction( int type, QString name,
int count, QString description, QString label, QString labels,
bool drawLabel ) :
mName( name ), mType( type ), mInputCount( count ),
mLabel( label ), mDescription( description ),
mDrawLabel( drawLabel )
bool drawLabel )
: mName( name )
, mType( type )
, mInputCount( count )
, mLabel( label )
, mDescription( description )
, mDrawLabel( drawLabel )
{
if ( mLabel.isEmpty() )
mLabel = mName;
@@ -2131,6 +2124,17 @@ QgsGrassMapcalcFunction::QgsGrassMapcalcFunction( int type, QString name,
}
}

QgsGrassMapcalcFunction::QgsGrassMapcalcFunction()
: mType( 0 )
, mInputCount( 0 )
, mDrawLabel( false )
{
}

QgsGrassMapcalcFunction::~QgsGrassMapcalcFunction()
{
}

/******************** CANVAS VIEW ******************************/

QgsGrassMapcalcView::QgsGrassMapcalcView( QgsGrassMapcalc * mapcalc,
@@ -219,11 +219,11 @@ class QgsGrassMapcalcFunction
Function
};

QgsGrassMapcalcFunction() {};
QgsGrassMapcalcFunction();
QgsGrassMapcalcFunction( int type, QString name, int count = 2,
QString description = "", QString label = "",
QString labels = "", bool drawLabel = true );
~QgsGrassMapcalcFunction() {};
~QgsGrassMapcalcFunction();

QString name() { return mName; }
int type() { return mType; }
@@ -149,8 +149,11 @@ QStringList QgsGrassModule::execArguments( QString module )
}

QgsGrassModule::QgsGrassModule( QgsGrassTools *tools, QString moduleName, QgisInterface *iface,
QString path, bool direct, QWidget * parent, Qt::WindowFlags f )
: QgsGrassModuleBase(), mSuccess( false ), mDirect( direct )
QString path, bool direct, QWidget *parent, Qt::WindowFlags f )
: QgsGrassModuleBase()
, mOptions( 0 )
, mSuccess( false )
, mDirect( direct )
{
Q_UNUSED( f );
QgsDebugMsg( "called" );
@@ -2033,8 +2036,18 @@ void QgsGrassModule::setDirectLibraryPath( QProcessEnvironment & environment )
QgsGrassModuleOption::QgsGrassModuleOption( QgsGrassModule *module, QString key,
QDomElement &qdesc, QDomElement &gdesc, QDomNode &gnode,
bool direct, QWidget * parent )
: QgsGrassModuleGroupBoxItem( module, key, qdesc, gdesc, gnode, direct, parent ),
mControlType( NoControl ), mValueType( String ), mOutputType( None ), mHaveLimits( false ), mIsOutput( false )
: QgsGrassModuleGroupBoxItem( module, key, qdesc, gdesc, gnode, direct, parent )
, mControlType( NoControl )
, mValueType( String )
, mOutputType( None )
, mHaveLimits( false )
, mMin( INT_MAX )
, mMax( INT_MIN )
, mComboBox( 0 )
, mIsOutput( false )
, mValidator( 0 )
, mLayout( 0 )
, mUsesRegion( false )
{
QgsDebugMsg( "called." );
setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum );
@@ -2540,11 +2553,14 @@ QgsGrassModuleInput::QgsGrassModuleInput( QgsGrassModule *module,
QDomElement &qdesc, QDomElement &gdesc, QDomNode &gnode,
bool direct, QWidget * parent )
: QgsGrassModuleGroupBoxItem( module, key, qdesc, gdesc, gnode, direct, parent )
, mType( QgsGrassModuleInput::Vector )
, mModuleStandardOptions( options )
, mGeometryTypeOption( "" )
, mVectorLayerOption( "" )
, mLayerComboBox( 0 )
, mRegionButton( 0 )
, mUpdate( false )
, mUsesRegion( false )
, mRequired( false )
{
QgsDebugMsg( "called." );

0 comments on commit b67daf0

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