Skip to content
Permalink
Browse files
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@7059 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Jul 4, 2007
1 parent bbe9992 commit 451230ed5cb61906899755827cfc701f8716a2f6
@@ -362,7 +362,7 @@ void QgsComposer::on_mActionPrint_activated(void)
try {
std::cout << "Print to file" << std::endl;

QPrinter::PageSize psize;
QPrinter::PageSize psize (QPrinter::A4); //default to A4

// WARNING mPrinter->outputFormat() returns always 0 in Qt 4.2.2
// => we have to check extension
@@ -383,7 +383,7 @@ void QgsComposerMap::on_mCalculateComboBox_activated( int )

double QgsComposerMap::scaleFromUserScale ( double us )
{
double s;
double s=0;

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

double QgsComposerMap::userScaleFromScale ( double s )
{
double us;
double us=0;

switch ( mComposition->mapCanvas()->mapUnits() ) {
case QGis::METERS :
@@ -156,8 +156,8 @@ QRect QgsComposerScalebar::render ( QPainter *p )
std::cout << "QgsComposerScalebar::render p = " << p << std::endl;

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

int xmin; // min x
int xmax; // max x
int xmin = 0; // min x
int xmax = 0; // max x
int ymin; // min y
int ymax; // max y

@@ -148,8 +148,8 @@ QRect QgsComposerVectorLegend::render ( QPainter *p )
std::cout << "QgsComposerVectorLegend::render p = " << p << std::endl;

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

Q3ListViewItemIterator it( mLayersListView );
int count = 0;
Q3ListViewItem *lastItem;
Q3ListViewItem *lastItem = NULL;
QString id;
while ( it.current() ) {
if ( it.current()->isSelected() ) {
@@ -232,7 +232,8 @@ void QgsGraduatedSymbolDialog::adjustClassification()
mClassListWidget->clear();
QGis::VectorType m_type = mVectorLayer->vectorType();
QgsVectorDataProvider *provider = dynamic_cast<QgsVectorDataProvider *>(mVectorLayer->getDataProvider());
double minimum, maximum;
double minimum = 0;
double maximum = 0;

//delete all previous entries
for(std::map<QString, QgsSymbol*>::iterator it=mEntries.begin();it!=mEntries.end();++it)
@@ -119,10 +119,10 @@ void QgsMapToolAddFeature::canvasReleaseEvent(QMouseEvent * e)
// snap point to points within the vector layer snapping tolerance
vlayer->snapPoint(savePoint, tolerance);

int size;
int size = 0;
char end=QgsApplication::endian();
unsigned char *wkb;
int wkbtype;
unsigned char *wkb = NULL;
int wkbtype = 0;
double x = savePoint.x();
double y = savePoint.y();

@@ -73,9 +73,7 @@ SET_SOURCE_FILES_PROPERTIES(
SET(QGIS_CORE_MOC_HDRS
qgscontexthelp.h
qgscoordinatetransform.h
qgscsexception.h
qgsdataprovider.h
qgsexception.h
qgshttptransaction.h
qgsmaplayer.h
qgsmaplayerregistry.h
@@ -87,9 +85,6 @@ qgsrunprocess.h
qgsvectorlayer.h

raster/qgsrasterlayer.h
raster/qgscolortable.h
raster/qgsrasterpyramid.h
raster/qgsrasterbandstats.h
raster/qgsrasterviewport.h
)

@@ -440,9 +440,17 @@ double QgsDistanceArea::computeDistanceBearing(
double lambda = L;
double lambdaP = 2*M_PI;

double sinLambda, cosLambda, sinSigma, cosSigma;
double sigma, alpha, cosSqAlpha, cos2SigmaM, C;
double tu1, tu2;
double sinLambda=0;
double cosLambda=0;
double sinSigma=0;
double cosSigma=0;
double sigma=0;
double alpha=0;
double cosSqAlpha=0;
double cos2SigmaM=0;
double C=0;
double tu1=0;
double tu2=0;

int iterLimit = 20;
while (fabs(lambda-lambdaP) > 1e-12 && --iterLimit>0)
@@ -379,7 +379,8 @@ QgsPoint QgsGeometry::closestVertex(const QgsPoint& point, QgsGeometryVertexInde
int vertexcounter = 0;
QGis::WKBTYPE wkbType;
double actdist = std::numeric_limits<double>::max();
double x,y;
double x=0;
double y=0;
double *tempx,*tempy;
memcpy(&wkbType, (mGeometry+1), sizeof(int));
beforeVertex = -1;
@@ -2057,8 +2058,10 @@ double QgsGeometry::closestSegmentWithContext(const QgsPoint& point,

QGis::WKBTYPE wkbType;
bool hasZValue = false;
double *thisx,*thisy;
double *prevx,*prevy;
double *thisx = NULL;
double *thisy = NULL;
double *prevx = NULL;
double *prevy = NULL;
double testdist;
int closestSegmentIndex = 0;

@@ -204,7 +204,8 @@ void QgsLabel::renderLabel( QPainter * painter, QgsRect &viewExtent,
QFontMetrics fm ( font );
int width = fm.width ( text );
int height = fm.height();
int dx, dy;
int dx = 0;
int dy = 0;

value = fieldValue ( Alignment, feature );
if ( value.isEmpty() )
@@ -241,8 +241,8 @@ QgsProject * QgsProject::theProject_;
{
QgsPropertyKey * currentProperty = &rootProperty;

QgsProperty * nextProperty; // link to next property down hiearchy
QgsPropertyKey * previousQgsPropertyKey; // link to previous property up hiearchy
QgsProperty * nextProperty = NULL; // link to next property down hiearchy
QgsPropertyKey * previousQgsPropertyKey = NULL; // link to previous property up hiearchy

QStringList keySequence = makeKeyTokens_( scope, key );

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

QgsDebugMsg("Layer type is " + type);

QgsMapLayer *mapLayer;
QgsMapLayer *mapLayer = NULL;

if (type == "vector")
{
@@ -352,18 +352,18 @@ bool QgsPropertyValue::writeXML( QString const & nodeName,


QgsPropertyKey::QgsPropertyKey( QString const name )
: name_( name )
: mName( name )
{
// since we own our properties, we are responsible for deleting the
// contents
properties_.setAutoDelete(true);
mProperties.setAutoDelete(true);
}

QVariant QgsPropertyKey::value() const
{
QgsProperty * foundQgsProperty;

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

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

QDomNode subkey = subkeys.item(i);

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

QDomNode subkey = subkeys.item(i);

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

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

if ( ! properties_.isEmpty() )
if ( ! mProperties.isEmpty() )
{
for (Q3DictIterator < QgsProperty > i(properties_); i.current(); ++i)
for (Q3DictIterator < QgsProperty > i(mProperties); i.current(); ++i)
{
if (!i.current()->writeXML(i.currentKey(), keyElement, document))
{
@@ -517,7 +517,7 @@ bool QgsPropertyKey::writeXML(QString const &nodeName, QDomElement & element, QD
void QgsPropertyKey::entryList( QStringList & entries ) const
{
// now add any leaf nodes to the entries list
for (Q3DictIterator<QgsProperty> i(properties_); i.current(); ++i)
for (Q3DictIterator<QgsProperty> i(mProperties); i.current(); ++i)
{
// add any of the nodes that have just a single value
if (i.current()->isLeaf())
@@ -532,7 +532,7 @@ void QgsPropertyKey::entryList( QStringList & entries ) const
void QgsPropertyKey::subkeyList(QStringList & entries) const
{
// now add any leaf nodes to the entries list
for (Q3DictIterator < QgsProperty > i(properties_); i.current(); ++i)
for (Q3DictIterator < QgsProperty > i(mProperties); i.current(); ++i)
{
// add any of the nodes that have just a single value
if (!i.current()->isLeaf())
@@ -551,7 +551,7 @@ bool QgsPropertyKey::isLeaf() const
}
else if (1 == count())
{
Q3DictIterator < QgsProperty > i(properties_);
Q3DictIterator < QgsProperty > i(mProperties);

if (i.current() && i.current()->isValue())
{
@@ -186,13 +186,13 @@ class CORE_EXPORT QgsPropertyValue : public QgsProperty
Can, itself, contain QgsPropertyKeys and QgsPropertyValues.
The internal QDict, properties_, maps key names to their respective
The internal QDict, mProperties, maps key names to their respective
QgsPropertyValue or next QgsPropertyKey in the key name sequence. The key with
the current name should contain its QgsPropertyValue.
E.g., given the key sequence "/foo/bar", "foo" will have a corresponding
QgsPropertyKey with a name "foo". It will contain an element in its
properties_ that maps to "bar", which is another QgsPropertyKey. The "bar"
mProperties that maps to "bar", which is another QgsPropertyKey. The "bar"
QgsPropertyKey will, in turn, have an element that maps to itself, i.e. "bar",
that will contain a QgsPropertyValue.
@@ -209,10 +209,10 @@ class CORE_EXPORT QgsPropertyKey : public QgsProperty
/// every key has a name
// @{
QString const & name() const
{ return name_; }
{ return mName; }

QString & name()
{ return name_; }
{ return mName; }
// @}


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

return dynamic_cast<QgsPropertyKey*>(properties_.find( keyName ));
return dynamic_cast<QgsPropertyKey*>(mProperties.find( keyName ));
}


/// remove the given key
bool removeKey( QString const & keyName )
{
return properties_.remove( keyName );
return mProperties.remove( keyName );
}

/** set the value associated with this key
@param name is the key name
*/
QgsPropertyValue * setValue( QString const & name, QVariant const & value )
{
properties_.replace( name, new QgsPropertyValue( value ) );
mProperties.replace( name, new QgsPropertyValue( value ) );

return dynamic_cast<QgsPropertyValue*>(properties_.find( name ));
return dynamic_cast<QgsPropertyValue*>(mProperties.find( name ));
}

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

/// how many elements are contained within this one?
size_t count() const
{ return properties_.count(); }
{ return mProperties.count(); }

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

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

/// delete any sub-nodes
virtual void clearKeys()
{
properties_.clear();
mProperties.clear();
}

QgsProperty * find( QString & propertyName )
{
return properties_.find( propertyName );
return mProperties.find( propertyName );
}

private:

/// every key has a name
QString name_;
QString mName;

/// sub-keys
Q3Dict < QgsProperty > properties_;
Q3Dict < QgsProperty > mProperties;

}; // class QgsPropertyKey

0 comments on commit 451230e

Please sign in to comment.