Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed May 28, 2014
1 parent 8d8e56d commit c1f50db
Show file tree
Hide file tree
Showing 21 changed files with 51 additions and 42 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Expand Up @@ -310,11 +310,15 @@ IF (PEDANTIC)
# disable warnings
ADD_DEFINITIONS( /wd4100 ) # unused formal parameters
ADD_DEFINITIONS( /wd4127 ) # constant conditional expressions (used in Qt template classes)
ADD_DEFINITIONS( /wd4231 ) # nonstandard extension used : 'identifier' before template explicit instantiation (used in Qt template classes)
ADD_DEFINITIONS( /wd4251 ) # needs to have dll-interface to be used by clients of class (occurs in Qt template classes)
ADD_DEFINITIONS( /wd4275 ) # non dll-interface class '...' used as base for dll-interface class '...'
ADD_DEFINITIONS( /wd4505 ) # unreferenced local function has been removed (QgsRasterDataProvider::extent)
ADD_DEFINITIONS( /wd4510 ) # default constructor could not be generated (sqlite3_index_info, QMap)
ADD_DEFINITIONS( /wd4512 ) # assignment operator could not be generated (sqlite3_index_info)
ADD_DEFINITIONS( /wd4610 ) # user defined constructor required (sqlite3_index_info)
ADD_DEFINITIONS( /wd4706 ) # assignment within conditional expression (pal)
ADD_DEFINITIONS( /wd4800 ) # 'int' : forcing value to bool 'true' or 'false' (performance warning)
ELSE (MSVC)
# add warnings via flags (not as definitions as on Mac -Wall can not be overridden per language )
SET(_warnings "-Wall -Wextra -Wno-long-long -Wformat-security -Wno-strict-aliasing")
Expand Down
7 changes: 6 additions & 1 deletion python/core/qgsexpression.sip
Expand Up @@ -39,6 +39,11 @@ class QgsExpression
//! @note this method does not expect that prepare() has been called on this instance
QVariant evaluate( const QgsFeature* f, const QgsFields& fields );

//! Evaluate the feature and return the result
//! @note this method does not expect that prepare() has been called on this instance
//! @note not available in python bindings
// inline QVariant evaluate( const QgsFeature& f, const QgsFields& fields ) { return evaluate( &f, fields ); }

//! Returns true if an error occurred when evaluating last input
bool hasEvalError() const;
//! Returns evaluation error
Expand All @@ -63,7 +68,7 @@ class QgsExpression

void setScale( double scale );

int scale();
double scale();

//! Return the expression string that was given when created.
const QString expression() const;
Expand Down
1 change: 1 addition & 0 deletions python/core/qgspallabeling.sip
Expand Up @@ -693,6 +693,7 @@ class QgsPalLabeling : QgsLabelingEngineInterface
virtual void drawLabeling( QgsRenderContext& context );
//! called when we're done with rendering
virtual void exit();

//! return infos about labels at a given (map) position
//! @deprecated since 2.4 - use takeResults() and methods of QgsLabelingResults
virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ) /Deprecated/;
Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposermapwidget.cpp
Expand Up @@ -250,7 +250,7 @@ void QgsComposerMapWidget::on_mAtlasPredefinedScaleRadio_toggled( bool checked )
{
// restore to fixed scale if no predefined scales exist
mAtlasFixedScaleRadio->blockSignals( true );
mAtlasFixedScaleRadio->setChecked( Qt::Checked );
mAtlasFixedScaleRadio->setChecked( true );
mAtlasFixedScaleRadio->blockSignals( false );
mComposerMap->setAtlasScalingMode( QgsComposerMap::Fixed );
}
Expand Down
2 changes: 2 additions & 0 deletions src/app/legend/qgsapplegendinterface.h
Expand Up @@ -30,6 +30,7 @@ class QgsMapLayer;
* QgsLegendInterface
* Abstract base class to make QgsLegend available to plugins.
*/
Q_NOWARN_DEPRECATED_PUSH
class QgsAppLegendInterface : public QgsLegendInterface
{
Q_OBJECT
Expand Down Expand Up @@ -117,5 +118,6 @@ class QgsAppLegendInterface : public QgsLegendInterface
int groupNodeToIndex( QgsLayerTreeGroup* group );
void setExpanded( QgsLayerTreeNode *node, bool expand );
};
Q_NOWARN_DEPRECATED_POP

#endif //QGSLEGENDAPPIFACE_H
2 changes: 2 additions & 0 deletions src/app/qgisappinterface.h
Expand Up @@ -32,6 +32,7 @@ class QgisApp;
* Only those functions "exposed" by QgisInterface can be called from within a
* plugin.
*/
Q_NOWARN_DEPRECATED_PUSH
class APP_EXPORT QgisAppInterface : public QgisInterface
{
Q_OBJECT
Expand Down Expand Up @@ -508,5 +509,6 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
//! Pointer to the PluginManagerInterface object
QgsAppPluginManagerInterface pluginManagerIface;
};
Q_NOWARN_DEPRECATED_POP

#endif //#define QGISAPPINTERFACE_H
2 changes: 1 addition & 1 deletion src/app/qgsmaptooldeletepart.cpp
Expand Up @@ -111,7 +111,7 @@ void QgsMapToolDeletePart::canvasReleaseEvent( QMouseEvent *e )
return;
}

QgsGeometry* QgsMapToolDeletePart::partUnderPoint( QPoint point, int& fid, int& partNum )
QgsGeometry* QgsMapToolDeletePart::partUnderPoint( QPoint point, QgsFeatureId& fid, int& partNum )
{
QgsFeature f;
QgsGeometry* geomPart = new QgsGeometry();
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptooldeletepart.h
Expand Up @@ -43,14 +43,14 @@ class APP_EXPORT QgsMapToolDeletePart: public QgsMapToolEdit
QgsVectorLayer* vlayer;
QList<QgsSnappingResult> mRecentSnappingResults;

QgsGeometry* partUnderPoint( QPoint p, int &fid, int &partNum );
QgsGeometry* partUnderPoint( QPoint p, QgsFeatureId &fid, int &partNum );

/* Rubberband that shows the part being deleted*/
QgsRubberBand* mRubberBand;

//The feature and part where the mouse cursor was pressed
//This is used to check whether we are still in the same part at cursor release
int mPressedFid;
QgsFeatureId mPressedFid;
int mPressedPartNum;
};

Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptooldeletering.cpp
Expand Up @@ -111,7 +111,7 @@ void QgsMapToolDeleteRing::canvasReleaseEvent( QMouseEvent *e )
}
}

QgsGeometry* QgsMapToolDeleteRing::ringUnderPoint( QgsPoint p, int& fid, int& partNum, int& ringNum )
QgsGeometry* QgsMapToolDeleteRing::ringUnderPoint( QgsPoint p, QgsFeatureId& fid, int& partNum, int& ringNum )
{
//There is no clean way to find if we are inside the ring of a feature,
//so we iterate over all the features visible in the canvas
Expand All @@ -120,7 +120,7 @@ QgsGeometry* QgsMapToolDeleteRing::ringUnderPoint( QgsPoint p, int& fid, int& pa
QgsFeatureIterator fit = vlayer->getFeatures( QgsFeatureRequest().setFilterRect( mCanvas->extent() ) );
QgsFeature f;
QgsGeometry* g;
QgsGeometry* ringGeom;
QgsGeometry* ringGeom = 0;
QgsMultiPolygon pol;
QgsPolygon tempPol;
QgsGeometry* tempGeom;
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptooldeletering.h
Expand Up @@ -54,13 +54,13 @@ class APP_EXPORT QgsMapToolDeleteRing : public QgsMapToolVertexEdit
/*! return the geometry of the ring under the point p and sets fid to the feature id,
* partNum to the part number in the feature and ringNum to the ring number in the part
*/
QgsGeometry* ringUnderPoint( QgsPoint p, int& fid, int& partNum, int& ringNum );
QgsGeometry* ringUnderPoint( QgsPoint p, QgsFeatureId& fid, int& partNum, int& ringNum );

/* Rubberband that shows the ring being deleted*/
QgsRubberBand* mRubberBand;

//The feature, part and ring the mouse was pressed in, to check we are still in the same ring at release
int mPressedFid;
QgsFeatureId mPressedFid;
int mPressedPartNum;
int mPressedRingNum;
};
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsmaptoollabel.cpp
Expand Up @@ -451,7 +451,7 @@ int QgsMapToolLabel::dataDefinedColumnIndex( QgsPalLayerSettings::DataDefinedPro
return -1;
}

bool QgsMapToolLabel::dataDefinedPosition( QgsVectorLayer* vlayer, int featureId, double& x, bool& xSuccess, double& y, bool& ySuccess, int& xCol, int& yCol ) const
bool QgsMapToolLabel::dataDefinedPosition( QgsVectorLayer* vlayer, const QgsFeatureId &featureId, double& x, bool& xSuccess, double& y, bool& ySuccess, int& xCol, int& yCol ) const
{
xSuccess = false;
ySuccess = false;
Expand Down Expand Up @@ -504,7 +504,7 @@ bool QgsMapToolLabel::layerIsRotatable( QgsMapLayer* layer, int& rotationCol ) c
return false;
}

bool QgsMapToolLabel::dataDefinedRotation( QgsVectorLayer* vlayer, int featureId, double& rotation, bool& rotationSuccess, bool ignoreXY ) const
bool QgsMapToolLabel::dataDefinedRotation( QgsVectorLayer* vlayer, const QgsFeatureId &featureId, double& rotation, bool& rotationSuccess, bool ignoreXY ) const
{
rotationSuccess = false;
if ( !vlayer )
Expand Down Expand Up @@ -540,7 +540,7 @@ bool QgsMapToolLabel::dataDefinedRotation( QgsVectorLayer* vlayer, int featureId
return true;
}

bool QgsMapToolLabel::dataDefinedShowHide( QgsVectorLayer* vlayer, int featureId, int& show, bool& showSuccess, int& showCol ) const
bool QgsMapToolLabel::dataDefinedShowHide( QgsVectorLayer* vlayer, const QgsFeatureId &featureId, int& show, bool& showSuccess, int& showCol ) const
{
showSuccess = false;
if ( !vlayer )
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsmaptoollabel.h
Expand Up @@ -126,7 +126,7 @@ class APP_EXPORT QgsMapToolLabel: public QgsMapTool
@param xCol out: index of the x position column
@param yCol out: index of the y position column
@return false if layer does not have data defined label position enabled*/
bool dataDefinedPosition( QgsVectorLayer* vlayer, int featureId, double& x, bool& xSuccess, double& y, bool& ySuccess, int& xCol, int& yCol ) const;
bool dataDefinedPosition( QgsVectorLayer* vlayer, const QgsFeatureId &featureId, double& x, bool& xSuccess, double& y, bool& ySuccess, int& xCol, int& yCol ) const;

/**Returns data defined rotation of a feature.
@param vlayer vector layer
Expand All @@ -136,7 +136,7 @@ class APP_EXPORT QgsMapToolLabel: public QgsMapTool
@param ignoreXY ignore that x and y are required to be data-defined
@return true if data defined rotation is enabled on the layer
*/
bool dataDefinedRotation( QgsVectorLayer* vlayer, int featureId, double& rotation, bool& rotationSuccess, bool ignoreXY = false ) const;
bool dataDefinedRotation( QgsVectorLayer* vlayer, const QgsFeatureId &featureId, double& rotation, bool& rotationSuccess, bool ignoreXY = false ) const;

/**Returns data defined show/hide of a feature.
@param vlayer vector layer
Expand All @@ -146,7 +146,7 @@ class APP_EXPORT QgsMapToolLabel: public QgsMapTool
@param showCol out: index of the show label column
@return true if data defined show/hide is enabled on the layer
*/
bool dataDefinedShowHide( QgsVectorLayer* vlayer, int featureId, int& show, bool& showSuccess, int& showCol ) const;
bool dataDefinedShowHide( QgsVectorLayer* vlayer, const QgsFeatureId &featureId, int& show, bool& showSuccess, int& showCol ) const;

private:
QgsPalLayerSettings mInvalidLabelSettings;
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptoolshowhidelabels.cpp
Expand Up @@ -260,7 +260,7 @@ bool QgsMapToolShowHideLabels::selectedLabelFeatures( QgsVectorLayer* vlayer,
}

bool QgsMapToolShowHideLabels::showHideLabel( QgsVectorLayer* vlayer,
int fid,
const QgsFeatureId &fid,
bool hide )
{

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptoolshowhidelabels.h
Expand Up @@ -66,7 +66,7 @@ class APP_EXPORT QgsMapToolShowHideLabels : public QgsMapToolLabel

//! Show or hide chosen label by setting data defined Show Label to 0
bool showHideLabel( QgsVectorLayer* vlayer,
int fid,
const QgsFeatureId &fid,
bool hide );
};

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgscoordinatereferencesystem.cpp
Expand Up @@ -1516,7 +1516,7 @@ bool QgsCoordinateReferenceSystem::saveAsUserCRS( QString name )

QgsMessageLog::logMessage( QObject::tr( "Saved user CRS [%1]" ).arg( toProj4() ), QObject::tr( "CRS" ) );

int return_id;
qint64 return_id;
if ( myResult == SQLITE_OK )
{
return_id = sqlite3_last_insert_rowid( myDatabase );
Expand Down
3 changes: 2 additions & 1 deletion src/core/qgsexpression.h
Expand Up @@ -127,6 +127,7 @@ class CORE_EXPORT QgsExpression

//! Evaluate the feature and return the result
//! @note this method does not expect that prepare() has been called on this instance
//! @note not available in python bindings
inline QVariant evaluate( const QgsFeature& f, const QgsFields& fields ) { return evaluate( &f, fields ); }

//! Returns true if an error occurred when evaluating last input
Expand All @@ -153,7 +154,7 @@ class CORE_EXPORT QgsExpression

void setScale( double scale ) { mScale = scale; }

int scale() {return mScale; }
double scale() { return mScale; }

//! Return the expression string that was given when created.
const QString expression() const { return dump(); }
Expand Down
4 changes: 2 additions & 2 deletions src/core/qgsmaprenderer.h
Expand Up @@ -189,8 +189,8 @@ class CORE_EXPORT QgsMapRenderer : public QObject
void setScale( double scale ) {mScale = scale;}
double mapUnitsPerPixel() const { return mMapUnitsPerPixel; }

int width() const { return mSize.width(); }
int height() const { return mSize.height(); }
int width() const { return ( int ) mSize.width(); }
int height() const { return ( int ) mSize.height(); }

//! Recalculate the map scale
void updateScale();
Expand Down
10 changes: 3 additions & 7 deletions src/core/qgspallabeling.h
Expand Up @@ -64,10 +64,8 @@ class QgsVectorLayer;
class CORE_EXPORT QgsPalLayerSettings
{
public:
Q_NOWARN_DEPRECATED_PUSH
QgsPalLayerSettings();
QgsPalLayerSettings( const QgsPalLayerSettings& s );
Q_NOWARN_DEPRECATED_POP
~QgsPalLayerSettings();

//! @note added in 2.4
Expand Down Expand Up @@ -702,7 +700,7 @@ class CORE_EXPORT QgsLabelingResults
friend class QgsPalLabeling;
};


Q_NOWARN_DEPRECATED_PUSH
class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
{
public:
Expand Down Expand Up @@ -745,9 +743,7 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface

//! called when we're going to start with rendering
//! @deprecated since 2.4 - use override with QgsMapSettings
Q_NOWARN_DEPRECATED_PUSH
Q_DECL_DEPRECATED virtual void init( QgsMapRenderer* mr );
Q_NOWARN_DEPRECATED_POP
//! called when we're going to start with rendering
virtual void init( const QgsMapSettings& mapSettings );
//! called to find out whether the layer is used for labeling
Expand Down Expand Up @@ -776,14 +772,12 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
//! called when we're done with rendering
virtual void exit();

Q_NOWARN_DEPRECATED_PUSH
//! return infos about labels at a given (map) position
//! @deprecated since 2.4 - use takeResults() and methods of QgsLabelingResults
Q_DECL_DEPRECATED virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p );
//! return infos about labels within a given (map) rectangle
//! @deprecated since 2.4 - use takeResults() and methods of QgsLabelingResults
Q_DECL_DEPRECATED virtual QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r );
Q_NOWARN_DEPRECATED_POP

//! Return pointer to recently computed results (in drawLabeling()) and pass the ownership of results to the caller
//! @note added in 2.4
Expand Down Expand Up @@ -864,5 +858,7 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface

QgsLabelingResults* mResults;
};
Q_NOWARN_DEPRECATED_POP


#endif // QGSPALLABELING_H
22 changes: 10 additions & 12 deletions src/plugins/topology/topolTest.cpp
Expand Up @@ -315,7 +315,7 @@ ErrorList topolTest::checkDanglingLines( double tolerance, QgsVectorLayer* layer
QgsPoint p = pointIt->first;
QgsFeatureId k = pointIt->second;

int repetitions = endVerticesMap.count( p );
size_t repetitions = endVerticesMap.count( p );

//QgsGeometry* extentPoly =
if ( repetitions == 1 )
Expand Down Expand Up @@ -359,21 +359,21 @@ ErrorList topolTest::checkDuplicates( double tolerance, QgsVectorLayer *layer1,
int i = 0;
ErrorList errorList;

QList<int>* duplicateIds = new QList<int>();
QList<QgsFeatureId>* duplicateIds = new QList<QgsFeatureId>();

QgsSpatialIndex* index = mLayerIndexes[layer1->id()];

QgsGeometry* canvasExtentPoly = QgsGeometry::fromWkt( theQgsInterface->mapCanvas()->extent().asWktPolygon() );


QMap<int, FeatureLayer>::Iterator it;
QMap<int, FeatureLayer>::ConstIterator FeatureListEnd = mFeatureMap2.end();
QMap<QgsFeatureId, FeatureLayer>::Iterator it;
QMap<QgsFeatureId, FeatureLayer>::ConstIterator FeatureListEnd = mFeatureMap2.end();
for ( it = mFeatureMap2.begin(); it != FeatureListEnd; ++it )
{
if ( !( ++i % 100 ) )
emit progress( i );

int currentId = it->feature.id();
QgsFeatureId currentId = it->feature.id();

if ( duplicateIds->contains( currentId ) )
{
Expand Down Expand Up @@ -469,7 +469,7 @@ ErrorList topolTest::checkOverlaps( double tolerance, QgsVectorLayer *layer1, Qg
return errorList;
}

QList<int>* duplicateIds = new QList<int>();
QList<QgsFeatureId>* duplicateIds = new QList<QgsFeatureId>();

QgsSpatialIndex* index;
index = mLayerIndexes[layer1->id()];
Expand All @@ -480,14 +480,14 @@ ErrorList topolTest::checkOverlaps( double tolerance, QgsVectorLayer *layer1, Qg
return errorList;
}

QMap<int, FeatureLayer>::Iterator it;
QMap<int, FeatureLayer>::ConstIterator FeatureListEnd = mFeatureMap2.end();
QMap<QgsFeatureId, FeatureLayer>::Iterator it;
QMap<QgsFeatureId, FeatureLayer>::ConstIterator FeatureListEnd = mFeatureMap2.end();
for ( it = mFeatureMap2.begin(); it != FeatureListEnd; ++it )
{
if ( !( ++i % 100 ) )
emit progress( i );

int currentId = it->feature.id();
QgsFeatureId currentId = it->feature.id();

if ( duplicateIds->contains( currentId ) )
{
Expand Down Expand Up @@ -552,8 +552,6 @@ ErrorList topolTest::checkOverlaps( double tolerance, QgsVectorLayer *layer1, Qg
duplicateIds->append( mFeatureMap2[*cit].feature.id() );
}



if ( duplicate )
{
QList<FeatureLayer> fls;
Expand Down Expand Up @@ -812,7 +810,7 @@ ErrorList topolTest::checkPseudos( double tolerance, QgsVectorLayer *layer1, Qgs
QgsPoint p = pointIt->first;
QgsFeatureId k = pointIt->second;

int repetitions = endVerticesMap.count( p );
size_t repetitions = endVerticesMap.count( p );

if ( repetitions == 2 )
{
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/topology/topolTest.h
Expand Up @@ -250,7 +250,7 @@ class topolTest: public QObject
QMap<QString, TopologyRule> mTopologyRuleMap;

QList<FeatureLayer> mFeatureList1;
QMap<int, FeatureLayer> mFeatureMap2;
QMap<QgsFeatureId, FeatureLayer> mFeatureMap2;

QgisInterface* theQgsInterface;
bool mTestCancelled;
Expand Down

0 comments on commit c1f50db

Please sign in to comment.