Skip to content

Commit 07b1bbe

Browse files
author
timlinux
committedJul 4, 2007
Fixed compiler warnings:
- for potentially unintialised vars I set them all to 0, NULL or some similar default - grass has some warnings for multiple definitions of NDEBUG - Ive disabled warnings on all files relying on grass headers - and submitted a bug to grass. git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7059 c8812cc2-4d05-0410-92ff-de0c093fc19c

22 files changed

+108
-72
lines changed
 

‎src/app/composer/qgscomposer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ void QgsComposer::on_mActionPrint_activated(void)
362362
try {
363363
std::cout << "Print to file" << std::endl;
364364

365-
QPrinter::PageSize psize;
365+
QPrinter::PageSize psize (QPrinter::A4); //default to A4
366366

367367
// WARNING mPrinter->outputFormat() returns always 0 in Qt 4.2.2
368368
// => we have to check extension

‎src/app/composer/qgscomposermap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ void QgsComposerMap::on_mCalculateComboBox_activated( int )
383383

384384
double QgsComposerMap::scaleFromUserScale ( double us )
385385
{
386-
double s;
386+
double s=0;
387387

388388
switch ( mComposition->mapCanvas()->mapUnits() ) {
389389
case QGis::METERS :
@@ -402,7 +402,7 @@ double QgsComposerMap::scaleFromUserScale ( double us )
402402

403403
double QgsComposerMap::userScaleFromScale ( double s )
404404
{
405-
double us;
405+
double us=0;
406406

407407
switch ( mComposition->mapCanvas()->mapUnits() ) {
408408
case QGis::METERS :

‎src/app/composer/qgscomposerscalebar.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ QRect QgsComposerScalebar::render ( QPainter *p )
156156
std::cout << "QgsComposerScalebar::render p = " << p << std::endl;
157157

158158
// Painter can be 0, create dummy to avoid many if below
159-
QPainter *painter;
160-
QPixmap *pixmap;
159+
QPainter *painter = NULL;
160+
QPixmap *pixmap = NULL;
161161
if ( p ) {
162162
painter = p;
163163
} else {
@@ -191,8 +191,8 @@ QRect QgsComposerScalebar::render ( QPainter *p )
191191
// Not sure about Style Strategy, QFont::PreferMatch?
192192
font.setStyleStrategy ( (QFont::StyleStrategy) (QFont::PreferOutline | QFont::PreferAntialias) );
193193

194-
int xmin; // min x
195-
int xmax; // max x
194+
int xmin = 0; // min x
195+
int xmax = 0; // max x
196196
int ymin; // min y
197197
int ymax; // max y
198198

‎src/app/composer/qgscomposervectorlegend.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ QRect QgsComposerVectorLegend::render ( QPainter *p )
148148
std::cout << "QgsComposerVectorLegend::render p = " << p << std::endl;
149149

150150
// Painter can be 0, create dummy to avoid many if below
151-
QPainter *painter;
152-
QPixmap *pixmap;
151+
QPainter *painter = NULL;
152+
QPixmap *pixmap = NULL;
153153
if ( p ) {
154154
painter = p;
155155
} else {
@@ -753,7 +753,7 @@ void QgsComposerVectorLegend::groupLayers ( void )
753753

754754
Q3ListViewItemIterator it( mLayersListView );
755755
int count = 0;
756-
Q3ListViewItem *lastItem;
756+
Q3ListViewItem *lastItem = NULL;
757757
QString id;
758758
while ( it.current() ) {
759759
if ( it.current()->isSelected() ) {

‎src/app/qgsgraduatedsymboldialog.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ void QgsGraduatedSymbolDialog::adjustClassification()
232232
mClassListWidget->clear();
233233
QGis::VectorType m_type = mVectorLayer->vectorType();
234234
QgsVectorDataProvider *provider = dynamic_cast<QgsVectorDataProvider *>(mVectorLayer->getDataProvider());
235-
double minimum, maximum;
235+
double minimum = 0;
236+
double maximum = 0;
236237

237238
//delete all previous entries
238239
for(std::map<QString, QgsSymbol*>::iterator it=mEntries.begin();it!=mEntries.end();++it)

‎src/app/qgsmaptooladdfeature.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ void QgsMapToolAddFeature::canvasReleaseEvent(QMouseEvent * e)
119119
// snap point to points within the vector layer snapping tolerance
120120
vlayer->snapPoint(savePoint, tolerance);
121121

122-
int size;
122+
int size = 0;
123123
char end=QgsApplication::endian();
124-
unsigned char *wkb;
125-
int wkbtype;
124+
unsigned char *wkb = NULL;
125+
int wkbtype = 0;
126126
double x = savePoint.x();
127127
double y = savePoint.y();
128128

‎src/core/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ SET_SOURCE_FILES_PROPERTIES(
7373
SET(QGIS_CORE_MOC_HDRS
7474
qgscontexthelp.h
7575
qgscoordinatetransform.h
76-
qgscsexception.h
7776
qgsdataprovider.h
78-
qgsexception.h
7977
qgshttptransaction.h
8078
qgsmaplayer.h
8179
qgsmaplayerregistry.h
@@ -87,9 +85,6 @@ qgsrunprocess.h
8785
qgsvectorlayer.h
8886

8987
raster/qgsrasterlayer.h
90-
raster/qgscolortable.h
91-
raster/qgsrasterpyramid.h
92-
raster/qgsrasterbandstats.h
9388
raster/qgsrasterviewport.h
9489
)
9590

‎src/core/qgsdistancearea.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,17 @@ double QgsDistanceArea::computeDistanceBearing(
440440
double lambda = L;
441441
double lambdaP = 2*M_PI;
442442

443-
double sinLambda, cosLambda, sinSigma, cosSigma;
444-
double sigma, alpha, cosSqAlpha, cos2SigmaM, C;
445-
double tu1, tu2;
443+
double sinLambda=0;
444+
double cosLambda=0;
445+
double sinSigma=0;
446+
double cosSigma=0;
447+
double sigma=0;
448+
double alpha=0;
449+
double cosSqAlpha=0;
450+
double cos2SigmaM=0;
451+
double C=0;
452+
double tu1=0;
453+
double tu2=0;
446454

447455
int iterLimit = 20;
448456
while (fabs(lambda-lambdaP) > 1e-12 && --iterLimit>0)

‎src/core/qgsgeometry.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,8 @@ QgsPoint QgsGeometry::closestVertex(const QgsPoint& point, QgsGeometryVertexInde
379379
int vertexcounter = 0;
380380
QGis::WKBTYPE wkbType;
381381
double actdist = std::numeric_limits<double>::max();
382-
double x,y;
382+
double x=0;
383+
double y=0;
383384
double *tempx,*tempy;
384385
memcpy(&wkbType, (mGeometry+1), sizeof(int));
385386
beforeVertex = -1;
@@ -2057,8 +2058,10 @@ double QgsGeometry::closestSegmentWithContext(const QgsPoint& point,
20572058

20582059
QGis::WKBTYPE wkbType;
20592060
bool hasZValue = false;
2060-
double *thisx,*thisy;
2061-
double *prevx,*prevy;
2061+
double *thisx = NULL;
2062+
double *thisy = NULL;
2063+
double *prevx = NULL;
2064+
double *prevy = NULL;
20622065
double testdist;
20632066
int closestSegmentIndex = 0;
20642067

‎src/core/qgslabel.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ void QgsLabel::renderLabel( QPainter * painter, QgsRect &viewExtent,
204204
QFontMetrics fm ( font );
205205
int width = fm.width ( text );
206206
int height = fm.height();
207-
int dx, dy;
207+
int dx = 0;
208+
int dy = 0;
208209

209210
value = fieldValue ( Alignment, feature );
210211
if ( value.isEmpty() )

‎src/core/qgsproject.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ QgsProject * QgsProject::theProject_;
241241
{
242242
QgsPropertyKey * currentProperty = &rootProperty;
243243

244-
QgsProperty * nextProperty; // link to next property down hiearchy
245-
QgsPropertyKey * previousQgsPropertyKey; // link to previous property up hiearchy
244+
QgsProperty * nextProperty = NULL; // link to next property down hiearchy
245+
QgsPropertyKey * previousQgsPropertyKey = NULL; // link to previous property up hiearchy
246246

247247
QStringList keySequence = makeKeyTokens_( scope, key );
248248

@@ -679,7 +679,7 @@ static std::pair< bool, std::list<QDomNode> > _getMapLayers(QDomDocument const &
679679

680680
QgsDebugMsg("Layer type is " + type);
681681

682-
QgsMapLayer *mapLayer;
682+
QgsMapLayer *mapLayer = NULL;
683683

684684
if (type == "vector")
685685
{

‎src/core/qgsprojectproperty.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -352,18 +352,18 @@ bool QgsPropertyValue::writeXML( QString const & nodeName,
352352

353353

354354
QgsPropertyKey::QgsPropertyKey( QString const name )
355-
: name_( name )
355+
: mName( name )
356356
{
357357
// since we own our properties, we are responsible for deleting the
358358
// contents
359-
properties_.setAutoDelete(true);
359+
mProperties.setAutoDelete(true);
360360
}
361361

362362
QVariant QgsPropertyKey::value() const
363363
{
364364
QgsProperty * foundQgsProperty;
365365

366-
if ( 0 == ( foundQgsProperty = properties_.find(name()) ) )
366+
if ( 0 == ( foundQgsProperty = mProperties.find(name()) ) )
367367
{ // recurse down to next key
368368
return foundQgsProperty->value();
369369
} else
@@ -386,9 +386,9 @@ void QgsPropertyKey::dump( size_t tabs ) const
386386
tabs++;
387387
tabString.fill( '\t', tabs );
388388

389-
if ( ! properties_.isEmpty() )
389+
if ( ! mProperties.isEmpty() )
390390
{
391-
for (Q3DictIterator < QgsProperty > i(properties_); i.current(); ++i)
391+
for (Q3DictIterator < QgsProperty > i(mProperties); i.current(); ++i)
392392
{
393393
if ( i.current()->isValue() )
394394
{
@@ -453,11 +453,11 @@ bool QgsPropertyKey::readXML(QDomNode & keyNode)
453453
subkeys.item(i).isElement() && // and we're an element
454454
subkeys.item(i).toElement().hasAttribute("type")) // and we have a "type" attribute
455455
{ // then we're a key value
456-
properties_.replace(subkeys.item(i).nodeName(), new QgsPropertyValue);
456+
mProperties.replace(subkeys.item(i).nodeName(), new QgsPropertyValue);
457457

458458
QDomNode subkey = subkeys.item(i);
459459

460-
if (!properties_[subkeys.item(i).nodeName()]->readXML(subkey))
460+
if (!mProperties[subkeys.item(i).nodeName()]->readXML(subkey))
461461
{
462462
qDebug("%s:%d unable to parse key value %s", __FILE__, __LINE__,
463463
(const char *) subkeys.item(i).nodeName().utf8());
@@ -469,7 +469,7 @@ bool QgsPropertyKey::readXML(QDomNode & keyNode)
469469

470470
QDomNode subkey = subkeys.item(i);
471471

472-
if (!properties_[subkeys.item(i).nodeName()]->readXML(subkey))
472+
if (!mProperties[subkeys.item(i).nodeName()]->readXML(subkey))
473473
{
474474
qDebug("%s:%d unable to parse subkey %s", __FILE__, __LINE__,
475475
(const char *) subkeys.item(i).nodeName().utf8());
@@ -494,9 +494,9 @@ bool QgsPropertyKey::writeXML(QString const &nodeName, QDomElement & element, QD
494494

495495
QDomElement keyElement = document.createElement(nodeName); // DOM element for this property key
496496

497-
if ( ! properties_.isEmpty() )
497+
if ( ! mProperties.isEmpty() )
498498
{
499-
for (Q3DictIterator < QgsProperty > i(properties_); i.current(); ++i)
499+
for (Q3DictIterator < QgsProperty > i(mProperties); i.current(); ++i)
500500
{
501501
if (!i.current()->writeXML(i.currentKey(), keyElement, document))
502502
{
@@ -517,7 +517,7 @@ bool QgsPropertyKey::writeXML(QString const &nodeName, QDomElement & element, QD
517517
void QgsPropertyKey::entryList( QStringList & entries ) const
518518
{
519519
// now add any leaf nodes to the entries list
520-
for (Q3DictIterator<QgsProperty> i(properties_); i.current(); ++i)
520+
for (Q3DictIterator<QgsProperty> i(mProperties); i.current(); ++i)
521521
{
522522
// add any of the nodes that have just a single value
523523
if (i.current()->isLeaf())
@@ -532,7 +532,7 @@ void QgsPropertyKey::entryList( QStringList & entries ) const
532532
void QgsPropertyKey::subkeyList(QStringList & entries) const
533533
{
534534
// now add any leaf nodes to the entries list
535-
for (Q3DictIterator < QgsProperty > i(properties_); i.current(); ++i)
535+
for (Q3DictIterator < QgsProperty > i(mProperties); i.current(); ++i)
536536
{
537537
// add any of the nodes that have just a single value
538538
if (!i.current()->isLeaf())
@@ -551,7 +551,7 @@ bool QgsPropertyKey::isLeaf() const
551551
}
552552
else if (1 == count())
553553
{
554-
Q3DictIterator < QgsProperty > i(properties_);
554+
Q3DictIterator < QgsProperty > i(mProperties);
555555

556556
if (i.current() && i.current()->isValue())
557557
{

‎src/core/qgsprojectproperty.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,13 @@ class CORE_EXPORT QgsPropertyValue : public QgsProperty
186186
187187
Can, itself, contain QgsPropertyKeys and QgsPropertyValues.
188188
189-
The internal QDict, properties_, maps key names to their respective
189+
The internal QDict, mProperties, maps key names to their respective
190190
QgsPropertyValue or next QgsPropertyKey in the key name sequence. The key with
191191
the current name should contain its QgsPropertyValue.
192192
193193
E.g., given the key sequence "/foo/bar", "foo" will have a corresponding
194194
QgsPropertyKey with a name "foo". It will contain an element in its
195-
properties_ that maps to "bar", which is another QgsPropertyKey. The "bar"
195+
mProperties that maps to "bar", which is another QgsPropertyKey. The "bar"
196196
QgsPropertyKey will, in turn, have an element that maps to itself, i.e. "bar",
197197
that will contain a QgsPropertyValue.
198198
@@ -209,10 +209,10 @@ class CORE_EXPORT QgsPropertyKey : public QgsProperty
209209
/// every key has a name
210210
// @{
211211
QString const & name() const
212-
{ return name_; }
212+
{ return mName; }
213213

214214
QString & name()
215-
{ return name_; }
215+
{ return mName; }
216216
// @}
217217

218218

@@ -225,26 +225,26 @@ class CORE_EXPORT QgsPropertyKey : public QgsProperty
225225
/// add the given property key
226226
QgsPropertyKey * addKey( QString const & keyName )
227227
{
228-
properties_.replace( keyName, new QgsPropertyKey(keyName) );
228+
mProperties.replace( keyName, new QgsPropertyKey(keyName) );
229229

230-
return dynamic_cast<QgsPropertyKey*>(properties_.find( keyName ));
230+
return dynamic_cast<QgsPropertyKey*>(mProperties.find( keyName ));
231231
}
232232

233233

234234
/// remove the given key
235235
bool removeKey( QString const & keyName )
236236
{
237-
return properties_.remove( keyName );
237+
return mProperties.remove( keyName );
238238
}
239239

240240
/** set the value associated with this key
241241
@param name is the key name
242242
*/
243243
QgsPropertyValue * setValue( QString const & name, QVariant const & value )
244244
{
245-
properties_.replace( name, new QgsPropertyValue( value ) );
245+
mProperties.replace( name, new QgsPropertyValue( value ) );
246246

247-
return dynamic_cast<QgsPropertyValue*>(properties_.find( name ));
247+
return dynamic_cast<QgsPropertyValue*>(mProperties.find( name ));
248248
}
249249

250250
/** set the value associated with this key
@@ -267,11 +267,11 @@ class CORE_EXPORT QgsPropertyKey : public QgsProperty
267267

268268
/// how many elements are contained within this one?
269269
size_t count() const
270-
{ return properties_.count(); }
270+
{ return mProperties.count(); }
271271

272272
/// Does this property not have any subkeys or values?
273273
/* virtual */ bool isEmpty() const
274-
{ return properties_.isEmpty(); }
274+
{ return mProperties.isEmpty(); }
275275

276276
/** returns true if is a QgsPropertyKey */
277277
virtual bool isKey() const
@@ -297,28 +297,28 @@ class CORE_EXPORT QgsPropertyKey : public QgsProperty
297297
/// reset the QgsProperty key to prestine state
298298
virtual void clear()
299299
{
300-
name_ = "";
301-
properties_.clear();
300+
mName = "";
301+
mProperties.clear();
302302
}
303303

304304
/// delete any sub-nodes
305305
virtual void clearKeys()
306306
{
307-
properties_.clear();
307+
mProperties.clear();
308308
}
309309

310310
QgsProperty * find( QString & propertyName )
311311
{
312-
return properties_.find( propertyName );
312+
return mProperties.find( propertyName );
313313
}
314314

315315
private:
316316

317317
/// every key has a name
318-
QString name_;
318+
QString mName;
319319

320320
/// sub-keys
321-
Q3Dict < QgsProperty > properties_;
321+
Q3Dict < QgsProperty > mProperties;
322322

323323
}; // class QgsPropertyKey
324324

0 commit comments

Comments
 (0)
Please sign in to comment.