Skip to content
Permalink
Browse files

Fix some warnings when building with clang and -Weverything

  • Loading branch information
nyalldawson committed Dec 20, 2015
1 parent 80de178 commit ec35dbee92d2a97be6d14b6efdd05232fd9e6c18
Showing with 214 additions and 282 deletions.
  1. +1 −1 src/analysis/interpolation/DualEdgeTriangulation.h
  2. +1 −1 src/core/composer/qgscomposeritemcommand.h
  3. +1 −1 src/core/composer/qgscomposermultiframecommand.h
  4. +1 −1 src/core/dxf/qgsdxfexport.h
  5. +3 −3 src/core/effects/qgsimageoperation.h
  6. +4 −5 src/core/geometry/qgsgeometry.cpp
  7. +1 −1 src/core/geometry/qgsgeometryutils.cpp
  8. +1 −1 src/core/geometry/qgswkbptr.cpp
  9. +5 −5 src/core/geometry/qgswkbtypes.cpp
  10. +1 −1 src/core/gps/qgsgpsdconnection.cpp
  11. +1 −1 src/core/pal/feature.cpp
  12. +0 −2 src/core/pal/layer.cpp
  13. +9 −11 src/core/pal/pal.cpp
  14. +1 −6 src/core/pal/pointset.cpp
  15. +2 −4 src/core/pal/problem.cpp
  16. +20 −20 src/core/pal/rtree.hpp
  17. +0 −4 src/core/pal/util.cpp
  18. +2 −2 src/core/qgis.cpp
  19. +1 −1 src/core/qgseditformconfig.cpp
  20. +2 −2 src/core/qgsmaprenderer.h
  21. +1 −1 src/core/qgsmaptopixel.h
  22. +6 −5 src/core/qgsmapunitscale.h
  23. +3 −3 src/core/qgspoint.h
  24. +1 −1 src/core/qgssqlexpressioncompiler.h
  25. +1 −1 src/core/qgstransaction.cpp
  26. +4 −4 src/core/qgsvectorlayer.h
  27. +1 −1 src/core/qgsvectorlayereditbuffer.cpp
  28. +1 −1 src/core/qgsvectorlayereditpassthrough.cpp
  29. +5 −5 src/core/qgsvirtuallayerdefinition.cpp
  30. +0 −3 src/core/raster/qgscolorrampshader.cpp
  31. +0 −21 src/core/raster/qgscontrastenhancement.cpp
  32. +0 −3 src/core/raster/qgsraster.cpp
  33. +14 −14 src/core/raster/qgsrasterblock.h
  34. +0 −1 src/core/raster/qgsrasterdataprovider.cpp
  35. +2 −2 src/core/raster/qgsrasterhistogram.h
  36. +1 −1 src/core/raster/qgsrasterinterface.h
  37. +1 −1 src/core/raster/qgsrasterrange.h
  38. +17 −17 src/core/symbology-ng/qgsfillsymbollayerv2.cpp
  39. +7 −7 src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
  40. +6 −6 src/core/symbology-ng/qgsheatmaprenderer.cpp
  41. +7 −7 src/core/symbology-ng/qgslinesymbollayerv2.cpp
  42. +15 −15 src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
  43. +7 −7 src/core/symbology-ng/qgsrendererv2.cpp
  44. +2 −2 src/core/symbology-ng/qgsrulebasedrendererv2.cpp
  45. +10 −9 src/core/symbology-ng/qgssymbollayerv2utils.cpp
  46. +23 −23 src/core/symbology-ng/qgssymbolv2.cpp
  47. +15 −15 src/core/symbology-ng/qgsvectorcolorrampv2.cpp
  48. +1 −1 src/gui/attributetable/qgsattributetablemodel.cpp
  49. +0 −3 src/gui/editorwidgets/qgsrelationreferencewidget.cpp
  50. +0 −3 src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp
  51. +0 −1 src/gui/qgscolorschemelist.cpp
  52. +0 −9 src/gui/raster/qgsmultibandcolorrendererwidget.cpp
  53. +0 −1 src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
  54. +1 −1 src/providers/postgres/qgspostgresconn.h
  55. +0 −1 src/providers/postgres/qgspostgresfeatureiterator.cpp
  56. +0 −4 src/providers/postgres/qgspostgresprovider.cpp
  57. +0 −1 src/providers/wcs/qgswcscapabilities.cpp
  58. +0 −2 src/providers/wcs/qgswcsprovider.cpp
  59. +1 −1 tests/qt_modeltest/dynamictreemodel.h
  60. +4 −5 tests/src/python/test_qgsserver.py
@@ -220,7 +220,7 @@ inline DualEdgeTriangulation::DualEdgeTriangulation( int nop, Triangulation* dec

inline int DualEdgeTriangulation::getNumberOfPoints() const
{
return (( int )( mPointVector.count() ) );
return mPointVector.count();
}

inline Point3D* DualEdgeTriangulation::getPoint( unsigned int i ) const
@@ -137,7 +137,7 @@ class CORE_EXPORT QgsComposerMergeCommand: public QgsComposerItemCommand
~QgsComposerMergeCommand();

bool mergeWith( const QUndoCommand * command ) override;
int id() const override { return ( int )mContext; }
int id() const override { return static_cast< int >( mContext ); }

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Dec 20, 2015

Member

Wouldn't it be better to return the return type instead?

This comment has been minimized.

Copy link
@nyalldawson

nyalldawson Dec 20, 2015

Author Collaborator

@m-kuhn sorry, I don't understand. The return type here is int?

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Dec 20, 2015

Member

s/return/change/

Context id() const override;

This comment has been minimized.

Copy link
@nyalldawson

nyalldawson Dec 20, 2015

Author Collaborator

Ahh... It's overriding a qt method returning int though.

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Dec 20, 2015

Member

Ah, I see. Thanks for all the cleanup anyway, really like to see such commits.


private:
Context mContext;
@@ -81,7 +81,7 @@ class CORE_EXPORT QgsComposerMultiFrameMergeCommand: public QgsComposerMultiFram
~QgsComposerMultiFrameMergeCommand();

bool mergeWith( const QUndoCommand * command ) override;
int id() const override { return ( int )mContext; }
int id() const override { return static_cast< int >( mContext ); }

private:
Context mContext;
@@ -117,7 +117,7 @@ class CORE_EXPORT QgsDxfExport
* @param layerTitleAsName flag
* @see addLayers
*/
void setLayerTitleAsName( bool layerTitleAsName ) { mLayerTitleAsName = layerTitleAsName; };
void setLayerTitleAsName( bool layerTitleAsName ) { mLayerTitleAsName = layerTitleAsName; }

/**
* Retrieve wether layer title (where set) instead of name shall be use
@@ -219,7 +219,7 @@ class CORE_EXPORT QgsImageOperation
{
for ( unsigned int y = block.beginLine; y < block.endLine; ++y )
{
QRgb* ref = ( QRgb* )block.image->scanLine( y );
QRgb* ref = reinterpret_cast< QRgb* >( block.image->scanLine( y ) );
for ( unsigned int x = 0; x < block.lineLength; ++x )
{
mOperation( ref[x], x, y );
@@ -249,7 +249,7 @@ class CORE_EXPORT QgsImageOperation
{
for ( unsigned int y = block.beginLine; y < block.endLine; ++y )
{
QRgb* ref = ( QRgb* )block.image->scanLine( y );
QRgb* ref = reinterpret_cast< QRgb* >( block.image->scanLine( y ) );
mOperation( ref, block.lineLength, bpl );
}
}
@@ -259,7 +259,7 @@ class CORE_EXPORT QgsImageOperation
unsigned char* ref = block.image->scanLine( 0 ) + 4 * block.beginLine;
for ( unsigned int x = block.beginLine; x < block.endLine; ++x, ref += 4 )
{
mOperation(( QRgb* )ref, block.lineLength, bpl );
mOperation( reinterpret_cast< QRgb* >( ref ), block.lineLength, bpl );
}
}
}
@@ -317,7 +317,7 @@ QGis::WkbType QgsGeometry::wkbType() const
}
else
{
return ( QGis::WkbType )d->geometry->wkbType();
return static_cast< QGis::WkbType >( d->geometry->wkbType() );
}
}

@@ -328,7 +328,7 @@ QGis::GeometryType QgsGeometry::type() const
{
return QGis::UnknownGeometry;
}
return ( QGis::GeometryType )( QgsWKBTypes::geometryType( d->geometry->wkbType() ) );
return static_cast< QGis::GeometryType >( QgsWKBTypes::geometryType( d->geometry->wkbType() ) );
}

bool QgsGeometry::isMultipart() const
@@ -1917,7 +1917,6 @@ QgsGeometry* QgsGeometry::smooth( const unsigned int iterations, const double of
}
return QgsGeometry::fromMultiPolygon( resultMultipoly );
}
break;

case QGis::WKBUnknown:
default:
@@ -2303,7 +2302,7 @@ QgsGeometryEngine* QgsGeometry::createGeometryEngine( const QgsAbstractGeometryV

QDataStream& operator<<( QDataStream& out, const QgsGeometry& geometry )
{
QByteArray byteArray = QByteArray::fromRawData(( char * )geometry.asWkb(), geometry.wkbSize() ); // does not copy data and does not take ownership
QByteArray byteArray = QByteArray::fromRawData( reinterpret_cast< const char * >( geometry.asWkb() ), geometry.wkbSize() ); // does not copy data and does not take ownership
out << byteArray;
return out;
}
@@ -2320,6 +2319,6 @@ QDataStream& operator>>( QDataStream& in, QgsGeometry& geometry )

char *data = new char[byteArray.size()];
memcpy( data, byteArray.data(), byteArray.size() );
geometry.fromWkb(( unsigned char* )data, byteArray.size() );
geometry.fromWkb( reinterpret_cast< unsigned char* >( data ), byteArray.size() );
return in;
}
@@ -149,7 +149,7 @@ bool QgsGeometryUtils::lineIntersection( const QgsPointV2& p1, const QgsVector&
{
double d = v.y() * w.x() - v.x() * w.y();

if ( d == 0 )
if ( qgsDoubleNear( d, 0 ) )
return false;

double dx = q1.x() - p1.x();
@@ -2,7 +2,7 @@

QgsConstWkbPtr::QgsConstWkbPtr( const unsigned char *p ): mEndianSwap( false )
{
mP = ( unsigned char * ) p;
mP = const_cast< unsigned char * >( p );
}

QgsWKBTypes::Type QgsConstWkbPtr::readHeader() const
@@ -68,7 +68,7 @@ QgsWKBTypes::Type QgsWKBTypes::flatType( Type type )
QgsWKBTypes::Type QgsWKBTypes::parseType( const QString &wktStr )
{
QString typestr = wktStr.left( wktStr.indexOf( '(' ) ).simplified().remove( ' ' );
Q_FOREACH ( const Type& type, entries()->keys() )
Q_FOREACH ( Type type, entries()->keys() )
{
QMap< Type, wkbEntry >::const_iterator it = entries()->constFind( type );
if ( it != entries()->constEnd() && it.value().mName.compare( typestr, Qt::CaseInsensitive ) == 0 )
@@ -185,9 +185,9 @@ QgsWKBTypes::Type QgsWKBTypes::addZ( QgsWKBTypes::Type type )
//upgrade with z dimension
Type flat = flatType( type );
if ( hasM( type ) )
return ( QgsWKBTypes::Type )( flat + 3000 );
return static_cast< QgsWKBTypes::Type >( flat + 3000 );
else
return ( QgsWKBTypes::Type )( flat + 1000 );
return static_cast< QgsWKBTypes::Type >( flat + 1000 );
}

QgsWKBTypes::Type QgsWKBTypes::addM( QgsWKBTypes::Type type )
@@ -209,9 +209,9 @@ QgsWKBTypes::Type QgsWKBTypes::addM( QgsWKBTypes::Type type )
//upgrade with m dimension
Type flat = flatType( type );
if ( hasZ( type ) )
return ( QgsWKBTypes::Type )( flat + 3000 );
return static_cast< QgsWKBTypes::Type >( flat + 3000 );
else
return ( QgsWKBTypes::Type )( flat + 2000 );
return static_cast< QgsWKBTypes::Type >( flat + 2000 );
}

QgsWKBTypes::Type QgsWKBTypes::dropZ( QgsWKBTypes::Type type )
@@ -46,7 +46,7 @@ void QgsGpsdConnection::connected()

void QgsGpsdConnection::error( QAbstractSocket::SocketError socketError )
{
#if QGISDEBUG
#ifdef QGISDEBUG
QTcpSocket *socket = qobject_cast< QTcpSocket * >( mSource );
QgsDebugMsg( QString( "error: %1 %2" ).arg( socketError ).arg( socket->errorString() ) );
#else
@@ -30,7 +30,7 @@
#define _CRT_SECURE_NO_DEPRECATE


#if defined(_VERBOSE_) || (_DEBUG_)
#if defined(_VERBOSE_) || defined(_DEBUG_)
#include <iostream>
#endif

@@ -27,8 +27,6 @@
*
*/

#define _CRT_SECURE_NO_DEPRECATE

#include "pal.h"
#include "layer.h"
#include "palexception.h"
@@ -29,8 +29,6 @@

//#define _VERBOSE_

#define _CRT_SECURE_NO_DEPRECATE

#include "qgsgeometry.h"
#include "pal.h"
#include "layer.h"
@@ -151,7 +149,7 @@ namespace pal
bool extractFeatCallback( FeaturePart *ft_ptr, void *ctx )
{
double amin[2], amax[2];
FeatCallBackCtx *context = ( FeatCallBackCtx* ) ctx;
FeatCallBackCtx *context = reinterpret_cast< FeatCallBackCtx* >( ctx );

// Holes of the feature are obstacles
for ( int i = 0; i < ft_ptr->getNumSelfObstacles(); i++ )
@@ -200,7 +198,7 @@ namespace pal
bool extractObstaclesCallback( FeaturePart *ft_ptr, void *ctx )
{
double amin[2], amax[2];
ObstacleCallBackCtx *context = ( ObstacleCallBackCtx* ) ctx;
ObstacleCallBackCtx *context = reinterpret_cast< ObstacleCallBackCtx* >( ctx );

// insert into obstacles
ft_ptr->getBoundingBox( amin, amax );
@@ -218,8 +216,8 @@ namespace pal
bool filteringCallback( FeaturePart *featurePart, void *ctx )
{

RTree<LabelPosition*, double, 2, double> *cdtsIndex = (( FilterContext* ) ctx )->cdtsIndex;
Pal* pal = (( FilterContext* )ctx )->pal;
RTree<LabelPosition*, double, 2, double> *cdtsIndex = ( reinterpret_cast< FilterContext* >( ctx ) )->cdtsIndex;
Pal* pal = ( reinterpret_cast< FilterContext* >( ctx ) )->pal;

if ( pal->isCancelled() )
return false; // do not continue searching
@@ -230,7 +228,7 @@ namespace pal
LabelPosition::PruneCtx pruneContext;
pruneContext.obstacle = featurePart;
pruneContext.pal = pal;
cdtsIndex->Search( amin, amax, LabelPosition::pruneCallback, ( void* ) &pruneContext );
cdtsIndex->Search( amin, amax, LabelPosition::pruneCallback, static_cast< void* >( &pruneContext ) );

return true;
}
@@ -306,9 +304,9 @@ namespace pal

// find features within bounding box and generate candidates list
context.layer = layer;
layer->mFeatureIndex->Search( amin, amax, extractFeatCallback, ( void* ) &context );
layer->mFeatureIndex->Search( amin, amax, extractFeatCallback, static_cast< void* >( &context ) );
// find obstacles within bounding box
layer->mObstacleIndex->Search( amin, amax, extractObstaclesCallback, ( void* ) &obstacleContext );
layer->mObstacleIndex->Search( amin, amax, extractObstaclesCallback, static_cast< void* >( &obstacleContext ) );

layer->mMutex.unlock();

@@ -353,7 +351,7 @@ namespace pal
FilterContext filterCtx;
filterCtx.cdtsIndex = prob->candidates;
filterCtx.pal = this;
obstacles->Search( amin, amax, filteringCallback, ( void* ) &filterCtx );
obstacles->Search( amin, amax, filteringCallback, static_cast< void* >( &filterCtx ) );

if ( isCancelled() )
{
@@ -450,7 +448,7 @@ namespace pal
lp->getBoundingBox( amin, amax );

// lookup for overlapping candidate
prob->candidates->Search( amin, amax, LabelPosition::countOverlapCallback, ( void* ) lp );
prob->candidates->Search( amin, amax, LabelPosition::countOverlapCallback, static_cast< void* >( lp ) );

nbOverlaps += lp->getNumOverlaps();
}
@@ -27,10 +27,7 @@
*
*/

#ifndef POINT_SET_H
#define POINT_SET_H

#if defined(_VERBOSE_) || (_DEBUG_) || (_DEBUG_FULL_)
#if defined(_VERBOSE_) || defined(_DEBUG_) || defined(_DEBUG_FULL_)
#include <iostream>
#endif

@@ -1054,5 +1051,3 @@ namespace pal


} // end namespace

#endif
@@ -27,8 +27,6 @@
*
*/

#define _CRT_SECURE_NO_DEPRECATE

#include "pal.h"
#include "palstat.h"
#include "layer.h"
@@ -453,7 +451,7 @@ namespace pal

SubPart *current = nullptr;

#if _VERBOSE_
#ifdef _VERBOSE_
int subPartTotalSize = 0;
#endif

@@ -472,7 +470,7 @@ namespace pal
for ( i = 0; i < nbft; i++ )
{
parts[i] = subPart( r, i, isIn );
#if _VERBOSE_
#ifdef _VERBOSE_
subPartTotalSize += parts[i]->subSize;
#endif
ok[i] = false;

1 comment on commit ec35dbe

@m-kuhn

This comment has been minimized.

Copy link
Member

@m-kuhn m-kuhn commented on ec35dbe Dec 20, 2015

Good job!

Please sign in to comment.
You can’t perform that action at this time.