Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
another round of coverity and cppcheck fixes
  • Loading branch information
jef-n committed Jul 5, 2015
1 parent 5b54e26 commit 3856ccf
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 18 deletions.
10 changes: 5 additions & 5 deletions src/analysis/interpolation/TriDecorator.h
Expand Up @@ -19,18 +19,18 @@

#include "Triangulation.h"

/**Decorator class for Triangulations (s. Decorator pattern in Gamma et al.)*/
/** Decorator class for Triangulations (s. Decorator pattern in Gamma et al.)*/
class TriDecorator : public Triangulation
{
public:
TriDecorator();
TriDecorator( Triangulation* t );
explicit TriDecorator( Triangulation* t );
virtual ~TriDecorator();
virtual void addLine( Line3D* line, bool breakline ) override;
virtual int addPoint( Point3D* p ) override;
/**Adds an association to a triangulation*/
/** Adds an association to a triangulation*/
virtual void addTriangulation( Triangulation* t );
/**Performs a consistency check, remove this later*/
/** Performs a consistency check, remove this later*/
virtual void performConsistencyTest() override;
virtual bool calcNormal( double x, double y, Vector3D* result ) override;
virtual bool calcPoint( double x, double y, Point3D* result ) override;
Expand All @@ -56,7 +56,7 @@ class TriDecorator : public Triangulation
virtual bool swapEdge( double x, double y ) override;
virtual QList<int>* getPointsAroundEdge( double x, double y ) override;
protected:
/**Association with a Triangulation object*/
/** Association with a Triangulation object*/
Triangulation* mTIN;
};

Expand Down
5 changes: 3 additions & 2 deletions src/analysis/network/qgslinevectorlayerdirector.cpp
Expand Up @@ -35,8 +35,8 @@
class QgsPointCompare
{
public:
QgsPointCompare( double tolerance ) :
mTolerance( tolerance )
explicit QgsPointCompare( double tolerance )
: mTolerance( tolerance )
{ }

bool operator()( const QgsPoint& p1, const QgsPoint& p2 ) const
Expand Down Expand Up @@ -325,6 +325,7 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
TiePointInfo t;
t.mFirstPoint = pt1;
t.mLastPoint = pt2;
t.mLength = 0.0;
pointLengthIt = my_binary_search( pointLengthMap.begin(), pointLengthMap.end(), t, TiePointInfoCompare );

if ( pointLengthIt != pointLengthMap.end() )
Expand Down
3 changes: 2 additions & 1 deletion src/analysis/raster/qgsalignraster.cpp
Expand Up @@ -556,6 +556,7 @@ bool QgsAlignRaster::suggestedWarpOutput( const QgsAlignRaster::RasterInfo& info


QgsAlignRaster::RasterInfo::RasterInfo( const QString& layerpath )
: mBandCnt( 0 )
{
mDataset = GDALOpen( layerpath.toLocal8Bit().constData(), GA_ReadOnly );
if ( !mDataset )
Expand All @@ -564,7 +565,7 @@ QgsAlignRaster::RasterInfo::RasterInfo( const QString& layerpath )
mXSize = GDALGetRasterXSize( mDataset );
mYSize = GDALGetRasterYSize( mDataset );

GDALGetGeoTransform( mDataset, mGeoTransform );
( void ) GDALGetGeoTransform( mDataset, mGeoTransform );

// TODO: may be null or empty string
mCrsWkt = QString::fromAscii( GDALGetProjectionRef( mDataset ) );
Expand Down
8 changes: 6 additions & 2 deletions src/analysis/raster/qgsalignraster.h
Expand Up @@ -104,8 +104,12 @@ class ANALYSIS_EXPORT QgsAlignRaster
struct Item
{
Item( const QString& input, const QString& output )
: inputFilename( input ), outputFilename( output )
, resampleMethod( RA_NearestNeighbour ), rescaleValues( false ) {}
: inputFilename( input )
, outputFilename( output )
, resampleMethod( RA_NearestNeighbour )
, rescaleValues( false )
, srcCellSizeInDestCRS( 0.0 )
{}

//! filename of the source raster
QString inputFilename;
Expand Down
6 changes: 1 addition & 5 deletions src/providers/mssql/qgsmssqlsourceselect.cpp
Expand Up @@ -526,11 +526,7 @@ void QgsMssqlSourceSelect::on_btnConnect_clicked()
if ( useGeometryColumns )
{
QString testquery( "SELECT count(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'geometry_columns'" );
q.exec( testquery );
q.first();
int count = q.value( 0 ).toInt();
bool geometryColumnsFound = count != 0;
if ( !geometryColumnsFound )
if ( !q.exec( testquery ) || !q.first() || q.value( 0 ).toInt() == 0 )
{
QMessageBox::StandardButtons reply;
reply = QMessageBox::question( this, "Scan full database?",
Expand Down
2 changes: 1 addition & 1 deletion tests/src/core/testqgsatlascomposition.cpp
Expand Up @@ -44,6 +44,7 @@ class TestQgsAtlasComposition : public QObject
, mLabel2( 0 )
, mAtlasMap( 0 )
, mOverview( 0 )
, mMapSettings( 0 )
, mVectorLayer( 0 )
, mVectorLayer2( 0 )
, mAtlas( 0 )
Expand Down Expand Up @@ -88,7 +89,6 @@ class TestQgsAtlasComposition : public QObject
QgsComposerLabel* mLabel2;
QgsComposerMap* mAtlasMap;
QgsComposerMap* mOverview;
//QgsMapRenderer* mMapRenderer;
QgsMapSettings *mMapSettings;
QgsVectorLayer* mVectorLayer;
QgsVectorLayer* mVectorLayer2;
Expand Down
5 changes: 3 additions & 2 deletions tests/src/core/testqgscomposerpicture.cpp
Expand Up @@ -70,8 +70,9 @@ class TestQgsComposerPicture : public QObject
};

TestQgsComposerPicture::TestQgsComposerPicture()
: mComposition( NULL )
, mComposerPicture( NULL )
: mComposition( 0 )
, mComposerPicture( 0 )
, mMapSettings( 0 )
{

}
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgscomposertablev2.cpp
Expand Up @@ -41,6 +41,7 @@ class TestQgsComposerTableV2 : public QObject
public:
TestQgsComposerTableV2()
: mComposition( 0 )
, mMapSettings( 0 )
, mVectorLayer( 0 )
, mComposerAttributeTable( 0 )
, mFrame1( 0 )
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgsmaprotation.cpp
Expand Up @@ -42,6 +42,7 @@ class TestQgsMapRotation : public QObject
: mRasterLayer( 0 )
, mPointsLayer( 0 )
, mLinesLayer( 0 )
, mMapSettings( 0 )
{
mTestDataDir = QString( TEST_DATA_DIR ) + "/";
}
Expand Down

0 comments on commit 3856ccf

Please sign in to comment.