fix warnings

This commit is contained in:
Juergen E. Fischer 2014-05-29 01:42:53 +02:00
parent 8d8e56dce6
commit c1f50db1ac
21 changed files with 51 additions and 42 deletions

View File

@ -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")

View File

@ -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
@ -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;

View File

@ -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/;

View File

@ -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 );
}

View File

@ -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
@ -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

View File

@ -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
@ -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

View File

@ -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();

View File

@ -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;
};

View File

@ -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
@ -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;

View File

@ -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;
};

View File

@ -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;
@ -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 )
@ -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 )

View File

@ -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
@ -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
@ -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;

View File

@ -260,7 +260,7 @@ bool QgsMapToolShowHideLabels::selectedLabelFeatures( QgsVectorLayer* vlayer,
}
bool QgsMapToolShowHideLabels::showHideLabel( QgsVectorLayer* vlayer,
int fid,
const QgsFeatureId &fid,
bool hide )
{

View File

@ -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 );
};

View File

@ -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 );

View File

@ -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
@ -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(); }

View File

@ -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();

View File

@ -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
@ -702,7 +700,7 @@ class CORE_EXPORT QgsLabelingResults
friend class QgsPalLabeling;
};
Q_NOWARN_DEPRECATED_PUSH
class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
{
public:
@ -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
@ -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
@ -864,5 +858,7 @@ class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface
QgsLabelingResults* mResults;
};
Q_NOWARN_DEPRECATED_POP
#endif // QGSPALLABELING_H

View File

@ -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 )
@ -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 ) )
{
@ -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()];
@ -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 ) )
{
@ -552,8 +552,6 @@ ErrorList topolTest::checkOverlaps( double tolerance, QgsVectorLayer *layer1, Qg
duplicateIds->append( mFeatureMap2[*cit].feature.id() );
}
if ( duplicate )
{
QList<FeatureLayer> fls;
@ -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 )
{

View File

@ -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;

View File

@ -1695,7 +1695,7 @@
</widget>
</item>
<item>
<spacer name="horizontalSpacer_41">
<spacer name="horizontalSpacer_46">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>