Skip to content
Permalink
Browse files

Coverity fixes: uninitialised members

  • Loading branch information
nyalldawson committed Feb 16, 2015
1 parent f6d0e70 commit da092bf0547165b3979ddb30bc2d055c7e439c10
@@ -62,7 +62,8 @@ namespace pal
: pal( pal ), obstacle( obstacle ), active( active ),
toLabel( toLabel ), displayAll( displayAll ), centroidInside( false ), label_unit( label_unit ),
min_scale( min_scale ), max_scale( max_scale ),
arrangement( arrangement ), arrangementFlags( 0 ), mode( LabelPerFeature ), mergeLines( false )
arrangement( arrangement ), arrangementFlags( 0 ), mode( LabelPerFeature ), mergeLines( false ),
upsidedownLabels( Upright )
{

this->name = new char[strlen( lyrName ) +1];
@@ -2197,7 +2197,7 @@ namespace pal

maxit = probSize * pal->tabuMaxIt;

itwimp = probSize * pal->tabuMinIt;;
itwimp = probSize * pal->tabuMinIt;

stop_it = itwimp;

@@ -70,7 +70,10 @@ QgsVectorFileWriter::QgsVectorFileWriter(
, mLayer( NULL )
, mGeom( NULL )
, mError( NoError )
, mCodec( 0 )
, mWkbType( geometryType )
, mSymbologyExport( symbologyExport )
, mSymbologyScaleDenominator( 1.0 )
{
QString vectorFileName = theVectorFileName;
QString fileEncoding = theFileEncoding;
@@ -51,7 +51,9 @@ QgsVectorLayerImport::QgsVectorLayerImport( const QString &uri,
const QMap<QString, QVariant> *options,
QProgressDialog *progress )
: mErrorCount( 0 )
, mAttributeCount( -1 )
, mProgress( progress )

{
mProvider = NULL;

@@ -76,8 +78,6 @@ QgsVectorLayerImport::QgsVectorLayerImport( const QString &uri,

delete myLib;

mAttributeCount = -1;

// create an empty layer
QString errMsg;
mError = pCreateEmpty( uri, fields, geometryType, crs, overwrite, &mOldToNewAttrIdx, &errMsg, options );
@@ -27,6 +27,7 @@ originally part of the larger QgsRasterLayer class

QgsColorRampShader::QgsColorRampShader( double theMinimumValue, double theMaximumValue )
: QgsRasterShaderFunction( theMinimumValue, theMaximumValue )
, mColorRampType( INTERPOLATED )
, mClip( false )
{
QgsDebugMsg( "called." );
@@ -93,6 +93,7 @@ QgsRasterProjector::QgsRasterProjector(
, mDestRowsPerMatrixRow( 0.0 )
, mDestColsPerMatrixCol( 0.0 )
, pHelperTop( 0 ), pHelperBottom( 0 )
, mHelperTopRow( 0 )
, mCPCols( 0 )
, mCPRows( 0 )
, mSqrTolerance( 0.0 )
@@ -42,9 +42,14 @@
#endif

QgsShapeFile::QgsShapeFile( QString name, QString encoding )
: ogrLayer( 0 )
, import_canceled( false )
, valid( false )
, isMulti( false )
, hasMoreDimensions( false )
, features( 0 )
, fileName( name )
{
fileName = name;
features = 0;
QgsApplication::registerOgrDrivers();

QSettings settings;
@@ -57,8 +62,7 @@ QgsShapeFile::QgsShapeFile( QString name, QString encoding )
ogrLayer = OGR_DS_GetLayer( ogrDataSource, 0 );
features = OGR_L_GetFeatureCount( ogrLayer, true );
}
else
valid = false;

setDefaultTable();
// init the geometry types
geometries << "NULL" << "POINT" << "LINESTRING" << "POLYGON" << "MULTIPOINT"
@@ -69,10 +69,10 @@ const QString GPX_DESCRIPTION = QObject::tr( "GPS eXchange format provider" );

QgsGPXProvider::QgsGPXProvider( QString uri )
: QgsVectorDataProvider( uri )
, data( 0 )
, mFeatureType( WaypointType )
, mValid( false ) // assume that it won't work
{
// assume that it won't work
mValid = false;

// we always use UTF-8
mEncoding = QTextCodec::codecForName( "utf8" );

@@ -165,16 +165,6 @@ class QgsGPXProvider : public QgsVectorDataProvider
static const int attrCount;

bool mValid;
long mNumberFeatures;

struct wkbPoint
{
char byteOrder;
unsigned wkbType;
double x;
double y;
};
wkbPoint mWKBpt;

friend class QgsGPXFeatureSource;
};
@@ -411,11 +411,18 @@ QgsSpatiaLiteProvider::createEmptyLayer(

QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
: QgsVectorDataProvider( uri )
, valid( false )
, isQuery( false )
, mTableBased( false )
, mViewBased( false )
, mVShapeBased( false )
, mReadOnly( false )
, geomType( QGis::WKBUnknown )
, sqliteHandle( NULL )
, mSrid( -1 )
, spatialIndexRTree( false )
, spatialIndexMbrCache( false )
, enabledCapabilities( 0 )
, mGotSpatialiteVersion( false )
, mSpatialiteVersionMajor( 0 )
, mSpatialiteVersionMinor( 0 )
@@ -433,11 +440,9 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )

// trying to open the SQLite DB
spatialite_init( 0 );
valid = true;
handle = QgsSqliteHandle::openDb( mSqlitePath );
if ( handle == NULL )
{
valid = false;
return;
}
sqliteHandle = handle->handle();
@@ -486,7 +491,6 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
{
// invalid metadata
numberFeatures = 0;
valid = false;

QgsDebugMsg( "Invalid SpatiaLite layer" );
closeDb();
@@ -514,7 +518,6 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
{
// the table is not a geometry table
numberFeatures = 0;
valid = false;
QgsDebugMsg( "Invalid SpatiaLite layer" );
closeDb();
gaiaFreeVectorLayersList( list );
@@ -523,7 +526,6 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
if ( !getTableSummaryAbstractInterface( lyr ) ) // gets the extent and feature count
{
numberFeatures = 0;
valid = false;
QgsDebugMsg( "Invalid SpatiaLite layer" );
closeDb();
gaiaFreeVectorLayersList( list );
@@ -543,15 +545,13 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
{
// the table is not a geometry table
numberFeatures = 0;
valid = false;
QgsDebugMsg( "Invalid SpatiaLite layer" );
closeDb();
return;
}
if ( !getTableSummary() ) // gets the extent and feature count
{
numberFeatures = 0;
valid = false;
QgsDebugMsg( "Invalid SpatiaLite layer" );
closeDb();
return;
@@ -561,7 +561,6 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
}
if ( sqliteHandle == NULL )
{
valid = false;
QgsDebugMsg( "Invalid SpatiaLite layer" );
return;
}
@@ -576,6 +575,7 @@ QgsSpatiaLiteProvider::QgsSpatiaLiteProvider( QString const &uri )
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (double)" ), "FLOAT", QVariant::Double )
<< QgsVectorDataProvider::NativeType( tr( "Whole number (integer)" ), "INTEGER", QVariant::LongLong )
;
valid = true;
}

QgsSpatiaLiteProvider::~QgsSpatiaLiteProvider()
@@ -4145,7 +4145,7 @@ bool QgsSpatiaLiteProvider::checkLayerType()

QString sql;

if ( mGeometryColumn.isEmpty() && !(mQuery.startsWith( "(" ) && mQuery.endsWith( ")" )) )
if ( mGeometryColumn.isEmpty() && !( mQuery.startsWith( "(" ) && mQuery.endsWith( ")" ) ) )
{
// checking if is a non-spatial table
sql = QString( "SELECT type FROM sqlite_master "
@@ -420,6 +420,7 @@ void TestQgsRasterLayer::checkScaleOffset()
mReport += QString( " %1 = %2 <br>\n" ).arg( myProvider->generateBandName( bandNo ) ).arg( valueString );
delete myRasterLayer;
QVERIFY( false );
return;
}
else
{
@@ -436,6 +437,7 @@ void TestQgsRasterLayer::checkScaleOffset()
{
delete myRasterLayer;
QVERIFY( false );
return;
}

mReport += "<p>Passed</p>";

0 comments on commit da092bf

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