From 41f62a8e3a0448b577880914979acc640fc2956b Mon Sep 17 00:00:00 2001 From: jef Date: Sat, 21 Jun 2008 15:35:32 +0000 Subject: [PATCH] fix gcc 4.3 warnings, a gcc 4.3 compile error and a MSVC warning git-svn-id: http://svn.osgeo.org/qgis/trunk@8666 c8812cc2-4d05-0410-92ff-de0c093fc19c --- python/core/conversions.sip | 12 +++++++++++ python/core/qgsmaplayerregistry.sip | 7 +++---- python/core/qgsrasterlayer.sip | 12 +++++------ src/app/qgsrasterlayerproperties.cpp | 2 +- src/core/qgsmaplayerregistry.cpp | 2 +- src/core/qgsmaplayerregistry.h | 2 +- src/core/raster/qgsrasterlayer.cpp | 20 +++++++++---------- src/core/raster/qgsrasterlayer.h | 12 +++++------ .../postgres/qgspostgresextentthread.cpp | 2 ++ 9 files changed, 42 insertions(+), 29 deletions(-) diff --git a/python/core/conversions.sip b/python/core/conversions.sip index 14fe2c97135..d1e049e66d8 100644 --- a/python/core/conversions.sip +++ b/python/core/conversions.sip @@ -326,12 +326,18 @@ template Py_DECREF(d); if (kobj) + { Py_DECREF(kobj); + } if (tobj) + { Py_DECREF(tobj); + } else + { delete t; + } return NULL; } @@ -547,7 +553,9 @@ template PyObject *lst = PyList_New(0); PyDict_SetItem(d, t1obj, lst); if (lst) + { Py_DECREF(lst); + } } if (t1obj == NULL || t2obj == NULL || @@ -555,10 +563,14 @@ template { Py_DECREF(d); if (t1obj) + { Py_DECREF(t1obj); + } if (t2obj) + { Py_DECREF(t2obj); + } return NULL; } diff --git a/python/core/qgsmaplayerregistry.sip b/python/core/qgsmaplayerregistry.sip index fd02c968ae6..a5d1c60a748 100644 --- a/python/core/qgsmaplayerregistry.sip +++ b/python/core/qgsmaplayerregistry.sip @@ -14,10 +14,9 @@ public: //! Returns the instance pointer, creating the object on the first call static QgsMapLayerRegistry * instance(); -/*! Return the number of registered layers. - * - * */ - const int count(); + + //! Return the number of registered layers. + int count(); ~QgsMapLayerRegistry(); diff --git a/python/core/qgsrasterlayer.sip b/python/core/qgsrasterlayer.sip index 08504176607..5983ba01f3a 100644 --- a/python/core/qgsrasterlayer.sip +++ b/python/core/qgsrasterlayer.sip @@ -114,10 +114,10 @@ public: // Accessors for image height and width // /** \brief Accessor that returns the width of the (unclipped) raster */ - const int getRasterXDim(); + int getRasterXDim(); /** \brief Accessor that returns the height of the (unclipped) raster */ - const int getRasterYDim(); + int getRasterYDim(); // // Accessor and mutator for no data double @@ -126,7 +126,7 @@ public: bool isNoDataValueValid(); /** \brief Accessor that returns the NO_DATA entry for this raster. */ - const double getNoDataValue(bool* isValid=0); + double getNoDataValue(bool* isValid=0); /** \brief Mutator that allows the NO_DATA entry for this raster to be overridden. */ void setNoDataValue(double theNoData); @@ -152,11 +152,11 @@ public: void setStdDevsToPlot(double the); /** \brief Get the number of bands in this layer */ - const unsigned int getBandCount(); + unsigned int getBandCount(); /** \brief Get RasterBandStats for a band given its number (read only) */ const QgsRasterBandStats getRasterBandStats(int); /** \brief Check whether a given band number has stats associated with it */ - const bool hasStats(int theBandNoInt); + bool hasStats(int theBandNoInt); /** \brief Overloaded method that also returns stats for a band, but uses the band colour name * Note this approach is not recommeneded because it is possible for two gdal raster * bands to have the same name! @@ -165,7 +165,7 @@ public: /** \brief Get the number of a band given its name. Note this will be the rewritten name set * up in the constructor, and will not necessarily be the same as the name retrieved directly from gdal! * If no matching band is found zero will be returned! */ - const int getRasterBandNumber (const QString & theBandNameQString); + int getRasterBandNumber (const QString & theBandNameQString); /** \brief Get the name of a band given its number. */ const QString getRasterBandName(int theBandNoInt); /** \brief Find out whether a given band exists. */ diff --git a/src/app/qgsrasterlayerproperties.cpp b/src/app/qgsrasterlayerproperties.cpp index 2f7fae7f1a1..ce6b66ffde2 100644 --- a/src/app/qgsrasterlayerproperties.cpp +++ b/src/app/qgsrasterlayerproperties.cpp @@ -1560,7 +1560,7 @@ void QgsRasterLayerProperties::on_buttonBuildPyramids_clicked() // as true so that we can generate pyramids for them. // QgsRasterLayer::RasterPyramidList myPyramidList = mRasterLayer->buildRasterPyramidList(); - for ( unsigned int myCounterInt = 0; myCounterInt < lbxPyramidResolutions->count(); myCounterInt++ ) + for ( int myCounterInt = 0; myCounterInt < lbxPyramidResolutions->count(); myCounterInt++ ) { QListWidgetItem *myItem = lbxPyramidResolutions->item( myCounterInt ); if ( myItem->isSelected() ) diff --git a/src/core/qgsmaplayerregistry.cpp b/src/core/qgsmaplayerregistry.cpp index 180c74ae5ba..eb774db065a 100644 --- a/src/core/qgsmaplayerregistry.cpp +++ b/src/core/qgsmaplayerregistry.cpp @@ -53,7 +53,7 @@ QgsMapLayerRegistry::~QgsMapLayerRegistry() } // get the layer count (number of registered layers) -const int QgsMapLayerRegistry::count() +int QgsMapLayerRegistry::count() { return mMapLayers.size(); } diff --git a/src/core/qgsmaplayerregistry.h b/src/core/qgsmaplayerregistry.h index dfae47c488b..90db238cc27 100644 --- a/src/core/qgsmaplayerregistry.h +++ b/src/core/qgsmaplayerregistry.h @@ -44,7 +44,7 @@ public: /*! Return the number of registered layers. * * */ - const int count(); + int count(); ~QgsMapLayerRegistry(); diff --git a/src/core/raster/qgsrasterlayer.cpp b/src/core/raster/qgsrasterlayer.cpp index 8c2cd653da2..d16ecb9bb53 100644 --- a/src/core/raster/qgsrasterlayer.cpp +++ b/src/core/raster/qgsrasterlayer.cpp @@ -1190,7 +1190,7 @@ bool QgsRasterLayer::draw(QgsRenderContext& renderContext) } else { - if ((myRasterViewPort->drawableAreaXDim) > 4000 && (myRasterViewPort->drawableAreaYDim > 4000)) + if ((myRasterViewPort->drawableAreaXDim) > 4000 && (myRasterViewPort->drawableAreaYDim > 4000)) { // We have scaled one raster pixel to more than 4000 screen pixels. What's the point of showing this layer? // Instead, we just stop displaying the layer. Prevents allocating the entire world of memory for showing @@ -2238,7 +2238,7 @@ const QgsRasterBandStats QgsRasterLayer::getRasterBandStats(QString const & theB //note this should be the rewritten name set up in the constructor, //not the name retrieved directly from gdal! //if no matching band is found zero will be returned! -const int QgsRasterLayer::getRasterBandNumber(QString const & theBandNameQString) +int QgsRasterLayer::getRasterBandNumber(QString const & theBandNameQString) { for (int myIterator = 0; myIterator < mRasterStatsList.size(); ++myIterator) { @@ -2280,7 +2280,7 @@ const QString QgsRasterLayer::getRasterBandName(int theBandNo) /** Check whether a given band number has stats associated with it */ -const bool QgsRasterLayer::hasStats(int theBandNo) +bool QgsRasterLayer::hasStats(int theBandNo) { if (theBandNo <= mRasterStatsList.size()) { @@ -2637,7 +2637,7 @@ const QgsRasterBandStats QgsRasterLayer::getRasterBandStats(int theBandNo) //mutator for red band name (allows alternate mappings e.g. map blue as red colour) -void QgsRasterLayer::setRedBandName(QString const & theBandNameQString) +void QgsRasterLayer::setRedBandName(QString const & theBandNameQString) { QgsDebugMsg("setRedBandName : " + theBandNameQString); //check if the band is unset @@ -2674,7 +2674,7 @@ void QgsRasterLayer::setRedBandName(QString const & theBandNameQString) //mutator for green band name -void QgsRasterLayer::setGreenBandName(QString const & theBandNameQString) +void QgsRasterLayer::setGreenBandName(QString const & theBandNameQString) { //check if the band is unset if (theBandNameQString == TRSTRING_NOT_SET || theBandNameQString == QSTRING_NOT_SET ) @@ -2708,7 +2708,7 @@ void QgsRasterLayer::setGreenBandName(QString const & theBandNameQString) } //mutator for blue band name -void QgsRasterLayer::setBlueBandName(QString const & theBandNameQString) +void QgsRasterLayer::setBlueBandName(QString const & theBandNameQString) { //check if the band is unset if (theBandNameQString == TRSTRING_NOT_SET || theBandNameQString == QSTRING_NOT_SET) @@ -2742,7 +2742,7 @@ void QgsRasterLayer::setBlueBandName(QString const & theBandNameQString) } //mutator for transparent band name -void QgsRasterLayer::setTransparentBandName(QString const & theBandNameQString) +void QgsRasterLayer::setTransparentBandName(QString const & theBandNameQString) { //check if the band is unset if (theBandNameQString == TRSTRING_NOT_SET) @@ -2776,7 +2776,7 @@ void QgsRasterLayer::setTransparentBandName(QString const & theBandNameQString) //mutator for gray band name -void QgsRasterLayer::setGrayBandName(QString const & theBandNameQString) +void QgsRasterLayer::setGrayBandName(QString const & theBandNameQString) { //check if the band is unset if (theBandNameQString == TRSTRING_NOT_SET || theBandNameQString == QSTRING_NOT_SET ) @@ -3348,7 +3348,7 @@ void QgsRasterLayer::setLayerOrder(QStringList const & layers) // Useful for Provider mode -void QgsRasterLayer::setSubLayerVisibility(QString const & name, bool vis) +void QgsRasterLayer::setSubLayerVisibility(QString const & name, bool vis) { if (mDataProvider) @@ -5110,7 +5110,7 @@ const QgsRasterDataProvider* QgsRasterLayer::getDataProvider() const return mDataProvider; } -const unsigned int QgsRasterLayer::getBandCount() +unsigned int QgsRasterLayer::getBandCount() { return mRasterStatsList.size(); } diff --git a/src/core/raster/qgsrasterlayer.h b/src/core/raster/qgsrasterlayer.h index 3ed0120a0a0..b4d6a62ae8a 100644 --- a/src/core/raster/qgsrasterlayer.h +++ b/src/core/raster/qgsrasterlayer.h @@ -284,10 +284,10 @@ public: // Accessors for image height and width // /** \brief Accessor that returns the width of the (unclipped) raster */ - const int getRasterXDim() {return mRasterXDim;} + int getRasterXDim() {return mRasterXDim;} /** \brief Accessor that returns the height of the (unclipped) raster */ - const int getRasterYDim() {return mRasterYDim;} + int getRasterYDim() {return mRasterYDim;} // // Accessor and mutator for no data double @@ -296,7 +296,7 @@ public: bool isNoDataValueValid() {return mValidNoDataValue;} /** \brief Accessor that returns the NO_DATA entry for this raster. */ - const double getNoDataValue(bool* isValid=0) { if(isValid) { *isValid = mValidNoDataValue;} return mNoDataValue;} + double getNoDataValue(bool* isValid=0) { if(isValid) { *isValid = mValidNoDataValue;} return mNoDataValue;} /** \brief Mutator that allows the NO_DATA entry for this raster to be overridden. */ void setNoDataValue(double theNoData); @@ -349,11 +349,11 @@ public: mStandardDeviations = theStdDevsToPlot; } /** \brief Get the number of bands in this layer */ - const unsigned int getBandCount(); + unsigned int getBandCount(); /** \brief Get RasterBandStats for a band given its number (read only) */ const QgsRasterBandStats getRasterBandStats(int); /** \brief Check whether a given band number has stats associated with it */ - const bool hasStats(int theBandNoInt); + bool hasStats(int theBandNoInt); /** \brief Overloaded method that also returns stats for a band, but uses the band colour name * Note this approach is not recommeneded because it is possible for two gdal raster * bands to have the same name! @@ -362,7 +362,7 @@ public: /** \brief Get the number of a band given its name. Note this will be the rewritten name set * up in the constructor, and will not necessarily be the same as the name retrieved directly from gdal! * If no matching band is found zero will be returned! */ - const int getRasterBandNumber (const QString & theBandNameQString); + int getRasterBandNumber (const QString & theBandNameQString); /** \brief Get the name of a band given its number. */ const QString getRasterBandName(int theBandNoInt); /** \brief Find out whether a given band exists. */ diff --git a/src/providers/postgres/qgspostgresextentthread.cpp b/src/providers/postgres/qgspostgresextentthread.cpp index 999b3fc32c6..053c2d2f72a 100644 --- a/src/providers/postgres/qgspostgresextentthread.cpp +++ b/src/providers/postgres/qgspostgresextentthread.cpp @@ -18,6 +18,8 @@ /* $Id$ */ #include +#include + #include #include #include