Skip to content
Permalink
Browse files

Fix some more clang-tidy suggestions

  • Loading branch information
nyalldawson committed Feb 20, 2017
1 parent e54bc9a commit db5dd854087d289231981d42151c72b0c649d30d
Showing with 83 additions and 80 deletions.
  1. +1 −1 src/core/composer/qgscomposernodesitem.cpp
  2. +2 −2 src/core/composer/qgscomposition.cpp
  3. +3 −3 src/core/geometry/qgsinternalgeometryengine.cpp
  4. +1 −1 src/core/gps/qextserialport/posix_qextserialport.cpp
  5. +1 −1 src/core/gps/qextserialport/qextserialport.cpp
  6. +1 −1 src/core/qgsexpression.cpp
  7. +1 −1 src/core/qgspallabeling.cpp
  8. +1 −1 src/core/qgsproject.cpp
  9. +1 −1 src/core/qgssqlstatement.cpp
  10. +2 −2 src/core/qgstextrenderer.cpp
  11. +1 −1 src/core/qgstracer.cpp
  12. +1 −1 src/core/raster/qgsrasterfilewriter.cpp
  13. +1 −2 src/core/symbology-ng/qgssymbollayerutils.cpp
  14. +0 −1 src/gui/qgsgradientstopeditor.cpp
  15. +8 −0 src/providers/delimitedtext/CMakeLists.txt
  16. +8 −0 src/providers/gdal/CMakeLists.txt
  17. +3 −4 src/providers/gdal/qgsgdalprovider.cpp
  18. +1 −1 src/providers/gdal/qgsgdalproviderbase.cpp
  19. +8 −0 src/providers/memory/CMakeLists.txt
  20. +8 −0 src/providers/ogr/CMakeLists.txt
  21. +0 −9 src/providers/ogr/qgsogrdataitems.cpp
  22. +0 −2 src/providers/ogr/qgsogrdataitems.h
  23. +1 −1 src/providers/ogr/qgsogrprovider.cpp
  24. +7 −0 src/providers/postgres/CMakeLists.txt
  25. +1 −1 src/providers/postgres/qgscolumntypethread.cpp
  26. +1 −1 src/providers/postgres/qgscolumntypethread.h
  27. +0 −4 src/providers/postgres/qgspgnewconnection.cpp
  28. +0 −1 src/providers/postgres/qgspgnewconnection.h
  29. +0 −4 src/providers/postgres/qgspgtablemodel.cpp
  30. +0 −1 src/providers/postgres/qgspgtablemodel.h
  31. +3 −19 src/providers/postgres/qgspostgresdataitems.cpp
  32. +3 −7 src/providers/postgres/qgspostgresdataitems.h
  33. +2 −2 src/providers/postgres/qgspostgresprovider.cpp
  34. +2 −2 src/providers/postgres/qgspostgresprovider.h
  35. +8 −0 src/providers/spatialite/CMakeLists.txt
  36. +1 −1 src/providers/spatialite/qgsspatialiteconnection.cpp
  37. +1 −1 src/providers/spatialite/qgsspatialitedataitems.cpp
@@ -21,7 +21,7 @@
#include "qgssymbol.h"
#include "qgsmapsettings.h"
#include <limits>
#include <math.h>
#include <cmath>

QgsComposerNodesItem::QgsComposerNodesItem( const QString& tagName,
QgsComposition* c )
@@ -2038,8 +2038,8 @@ QPointF QgsComposition::snapPointToGrid( QPointF scenePoint ) const
double yPage = scenePoint.y() - yOffset; //y-coordinate relative to current page

//snap x coordinate
int xRatio = static_cast< int >(( scenePoint.x() - mSnapGridOffsetX ) / mSnapGridResolution + 0.5 );
int yRatio = static_cast< int >(( yPage - mSnapGridOffsetY ) / mSnapGridResolution + 0.5 );
int xRatio = static_cast< int >(( scenePoint.x() - mSnapGridOffsetX ) / mSnapGridResolution + 0.5 ); //NOLINT
int yRatio = static_cast< int >(( yPage - mSnapGridOffsetY ) / mSnapGridResolution + 0.5 ); //NOLINT

double xSnapped = xRatio * mSnapGridResolution + mSnapGridOffsetX;
double ySnapped = yRatio * mSnapGridResolution + mSnapGridOffsetY + yOffset;
@@ -210,10 +210,10 @@ QgsGeometry QgsInternalGeometryEngine::poleOfInaccessibility( double precision ,
0, polygon ) );
if ( bboxCell->d > bestCell->d )
{
bestCell.reset( bboxCell.release() );
bestCell = std::move( bboxCell );
}

while ( cellQueue.size() > 0 )
while ( !cellQueue.empty() )
{
// pick the most promising cell from the queue
std::unique_ptr< Cell > cell( cellQueue.top() );
@@ -223,7 +223,7 @@ QgsGeometry QgsInternalGeometryEngine::poleOfInaccessibility( double precision ,
// update the best cell if we found a better one
if ( currentCell->d > bestCell->d )
{
bestCell.reset( cell.release() );
bestCell = std::move( cell );
}

// do not drill down further if there's no chance of a better solution
@@ -1,7 +1,7 @@


#include <fcntl.h>
#include <stdio.h>
#include <cstdio>
#include "qextserialport.h"
#include <QMutexLocker>
#include <QDebug>
@@ -1,6 +1,6 @@


#include <stdio.h>
#include <cstdio>
#include "qextserialport.h"

/*!
@@ -24,7 +24,7 @@
#include <QUuid>
#include <QMutex>

#include <math.h>
#include <cmath>
#include <limits>

#include "qgsdistancearea.h"
@@ -1474,7 +1474,7 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont
return;
}

int divNum = static_cast< int >(( static_cast< double >( mFeaturesToLabel ) / maxNumLabels ) + 0.5 );
int divNum = static_cast< int >(( static_cast< double >( mFeaturesToLabel ) / maxNumLabels ) + 0.5 ); // NOLINT
if ( divNum && ( mFeatsRegPal == static_cast< int >( mFeatsSendingToPal / divNum ) ) )
{
mFeatsSendingToPal += 1;
@@ -698,7 +698,7 @@ bool QgsProject::addLayer( const QDomElement &layerElem, QList<QDomNode> &broken
return false;
}

Q_CHECK_PTR( mapLayer );
Q_CHECK_PTR( mapLayer ); // NOLINT

// have the layer restore state that is stored in Dom node
if ( mapLayer->readLayerXml( layerElem, pathResolver() ) && mapLayer->isValid() )
@@ -16,7 +16,7 @@

#include "qgssqlstatement.h"

#include <math.h>
#include <cmath>
#include <limits>

static const QRegExp IDENTIFIER_RE( "^[A-Za-z_\x80-\xff][A-Za-z0-9_\x80-\xff]*$" );
@@ -1614,7 +1614,7 @@ bool QgsTextFormat::containsAdvancedEffects() const

int QgsTextRenderer::sizeToPixel( double size, const QgsRenderContext& c, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale& mapUnitScale )
{
return static_cast< int >( c.convertToPainterUnits( size, unit, mapUnitScale ) + 0.5 );
return static_cast< int >( c.convertToPainterUnits( size, unit, mapUnitScale ) + 0.5 ); //NOLINT
}

void QgsTextRenderer::drawText( const QRectF& rect, double rotation, QgsTextRenderer::HAlignment alignment, const QStringList& textLines, QgsRenderContext& context, const QgsTextFormat& format, bool drawAsOutlines )
@@ -2248,7 +2248,7 @@ void QgsTextRenderer::drawShadow( QgsRenderContext& context, const QgsTextRender
bool mapUnits = shadow.blurRadiusUnit() == QgsUnitTypes::RenderMapUnits;
double radius = context.convertToPainterUnits( shadow.blurRadius(), shadow.blurRadiusUnit(), shadow.blurRadiusMapUnitScale() );
radius /= ( mapUnits ? context.scaleFactor() / component.dpiRatio : 1 );
radius = static_cast< int >( radius + 0.5 );
radius = static_cast< int >( radius + 0.5 ); //NOLINT

// TODO: add labeling gui option to adjust blurBufferClippingScale to minimize pixels, or
// to ensure shadow isn't clipped too tight. (Or, find a better method of buffering)
@@ -285,7 +285,7 @@ int point2edge( const QgsTracerGraph& g, const QgsPoint& pt, int& lineVertexAfte
double dist = closestSegment( e.coords, pt, vertexAfter, epsilon );
if ( dist == 0 )
{
lineVertexAfter = vertexAfter;
lineVertexAfter = vertexAfter; //NOLINT
return i;
}
}
@@ -972,7 +972,7 @@ void QgsRasterFileWriter::globalOutputParameters( const QgsRectangle& extent, in
//calculate nRows automatically for providers without exact resolution
if ( nRows < 0 )
{
nRows = static_cast< double >( nCols ) / extent.width() * extent.height() + 0.5;
nRows = static_cast< double >( nCols ) / extent.width() * extent.height() + 0.5; //NOLINT
}
geoTransform[0] = extent.xMinimum();
geoTransform[1] = pixelSize;
@@ -3757,18 +3757,17 @@ QList<double> QgsSymbolLayerUtils::prettyBreaks( double minimum, double maximum,
int divisions = classes;
double h = highBias;
double cell;
int U;
bool small = false;
double dx = maximum - minimum;

if ( qgsDoubleNear( dx, 0.0 ) && qgsDoubleNear( maximum, 0.0 ) )
{
cell = 1.0;
small = true;
U = 1;
}
else
{
int U = 1;
cell = qMax( qAbs( minimum ), qAbs( maximum ) );
if ( adjustBias >= 1.5 * h + 0.5 )
{
@@ -307,7 +307,6 @@ int QgsGradientStopEditor::findClosestStop( int x, int threshold ) const
if (( threshold < 0 || currentDiff < threshold ) && currentDiff < closestDiff )
{
closestStop = mGradient.count() - 1;
closestDiff = currentDiff;
}

return closestStop;
@@ -41,6 +41,14 @@ TARGET_LINK_LIBRARIES(delimitedtextprovider
qgis_gui
)

# clang-tidy
IF(CLANG_TIDY_EXE)
SET_TARGET_PROPERTIES(
delimitedtextprovider PROPERTIES
CXX_CLANG_TIDY "${DO_CLANG_TIDY}"
)
ENDIF(CLANG_TIDY_EXE)

########################################################
# Install

@@ -31,6 +31,14 @@ TARGET_LINK_LIBRARIES (gdalprovider
qgis_gui
)

# clang-tidy
IF(CLANG_TIDY_EXE)
SET_TARGET_PROPERTIES(
gdalprovider PROPERTIES
CXX_CLANG_TIDY "${DO_CLANG_TIDY}"
)
ENDIF(CLANG_TIDY_EXE)

INSTALL(TARGETS gdalprovider
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
@@ -636,7 +636,6 @@ void QgsGdalProvider::readBlock( int theBandNo, QgsRectangle const & theExtent,
}

qgsFree( tmpBlock );
return;
}

//void * QgsGdalProvider::readBlock( int bandNo, QgsRectangle const & extent, int width, int height )
@@ -1769,8 +1768,8 @@ QList<QgsRasterPyramid> QgsGdalProvider::buildPyramidList( QList<int> overviewLi

QgsRasterPyramid myRasterPyramid;
myRasterPyramid.level = myDivisor;
myRasterPyramid.xDim = ( int )( 0.5 + ( myWidth / ( double )myDivisor ) );
myRasterPyramid.yDim = ( int )( 0.5 + ( myHeight / ( double )myDivisor ) );
myRasterPyramid.xDim = ( int )( 0.5 + ( myWidth / ( double )myDivisor ) ); // NOLINT
myRasterPyramid.yDim = ( int )( 0.5 + ( myHeight / ( double )myDivisor ) ); // NOLINT
myRasterPyramid.exists = false;

QgsDebugMsg( QString( "Pyramid %1 xDim %2 yDim %3" ).arg( myRasterPyramid.level ).arg( myRasterPyramid.xDim ).arg( myRasterPyramid.yDim ) );
@@ -1938,7 +1937,7 @@ void buildSupportedRasterFileFilterAndExtensions( QString & theFileFiltersString
{
myGdalDriver = GDALGetDriver( i );

Q_CHECK_PTR( myGdalDriver );
Q_CHECK_PTR( myGdalDriver ); // NOLINT

if ( !myGdalDriver )
{
@@ -280,7 +280,7 @@ CPLErr QgsGdalProviderBase::gdalRasterIO( GDALRasterBandH hBand, GDALRWFlag eRWF
{
GDALRasterIOExtraArg extra;
INIT_RASTERIO_EXTRA_ARG( extra );
if ( 0 && feedback ) // disabled!
if ( false && feedback ) // disabled!
{
// Currently the cancelation is disabled... When RasterIO call is canceled,
// GDAL returns CE_Failure with error code = 0 (CPLE_None), however one would
@@ -18,6 +18,14 @@ TARGET_LINK_LIBRARIES(memoryprovider
qgis_core
)

# clang-tidy
IF(CLANG_TIDY_EXE)
SET_TARGET_PROPERTIES(
memoryprovider PROPERTIES
CXX_CLANG_TIDY "${DO_CLANG_TIDY}"
)
ENDIF(CLANG_TIDY_EXE)


INSTALL (TARGETS memoryprovider
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
@@ -32,6 +32,14 @@ IF (MSVC)
SET(TARGET_LINK_LIBRARIES ${TARGET_LINK_LIBRARIE} odbc32 odbccp32)
ENDIF (MSVC)

# clang-tidy
IF(CLANG_TIDY_EXE)
SET_TARGET_PROPERTIES(
ogrprovider PROPERTIES
CXX_CLANG_TIDY "${DO_CLANG_TIDY}"
)
ENDIF(CLANG_TIDY_EXE)

INSTALL (TARGETS ogrprovider
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
@@ -55,11 +55,6 @@ QgsOgrLayerItem::QgsOgrLayerItem( QgsDataItem* parent,
}
}

QgsOgrLayerItem::~QgsOgrLayerItem()
{
}


bool QgsOgrLayerItem::setCrs( const QgsCoordinateReferenceSystem& crs )
{
if ( !( mCapabilities & SetCrs ) )
@@ -180,10 +175,6 @@ QgsOgrDataCollectionItem::QgsOgrDataCollectionItem( QgsDataItem* parent, QString
{
}

QgsOgrDataCollectionItem::~QgsOgrDataCollectionItem()
{
}

QVector<QgsDataItem*> QgsOgrDataCollectionItem::createChildren()
{
QVector<QgsDataItem*> children;
@@ -24,7 +24,6 @@ class QgsOgrLayerItem : public QgsLayerItem
Q_OBJECT
public:
QgsOgrLayerItem( QgsDataItem* parent, QString name, QString path, QString uri, LayerType layerType );
~QgsOgrLayerItem();

bool setCrs( const QgsCoordinateReferenceSystem& crs ) override;

@@ -37,7 +36,6 @@ class QgsOgrDataCollectionItem : public QgsDataCollectionItem
Q_OBJECT
public:
QgsOgrDataCollectionItem( QgsDataItem* parent, QString name, QString path );
~QgsOgrDataCollectionItem();

QVector<QgsDataItem*> createChildren() override;
};
@@ -2056,7 +2056,7 @@ QString createFilters( const QString& type )
{
driver = OGRGetDriver( i );

Q_CHECK_PTR( driver );
Q_CHECK_PTR( driver ); // NOLINT

if ( !driver )
{
@@ -72,6 +72,13 @@ TARGET_LINK_LIBRARIES (postgresprovider
qgis_gui
)

# clang-tidy
IF(CLANG_TIDY_EXE)
SET_TARGET_PROPERTIES(
postgresprovider PROPERTIES
CXX_CLANG_TIDY "${DO_CLANG_TIDY}"
)
ENDIF(CLANG_TIDY_EXE)

########################################################
# Install
@@ -22,7 +22,7 @@ email : jef at norbit dot de
#include <QMetaType>
#include <climits>

QgsGeomColumnTypeThread::QgsGeomColumnTypeThread( QString name, bool useEstimatedMetaData, bool allowGeometrylessTables )
QgsGeomColumnTypeThread::QgsGeomColumnTypeThread( const QString& name, bool useEstimatedMetaData, bool allowGeometrylessTables )
: QThread()
, mConn( nullptr )
, mName( name )
@@ -28,7 +28,7 @@ class QgsGeomColumnTypeThread : public QThread
{
Q_OBJECT
public:
QgsGeomColumnTypeThread( QString connName, bool useEstimatedMetaData, bool allowGeometrylessTables );
QgsGeomColumnTypeThread( const QString& connName, bool useEstimatedMetaData, bool allowGeometrylessTables );

// These functions get the layer types and pass that information out
// by emitting the setLayerType() signal.
@@ -178,10 +178,6 @@ void QgsPgNewConnection::on_cb_geometryColumnsOnly_clicked()

//! End Autoconnected SLOTS *

QgsPgNewConnection::~QgsPgNewConnection()
{
}

void QgsPgNewConnection::testConnection()
{
QgsDataSourceUri uri;
@@ -32,7 +32,6 @@ class QgsPgNewConnection : public QDialog, private Ui::QgsPgNewConnectionBase
//! Constructor
QgsPgNewConnection( QWidget *parent = nullptr, const QString& connName = QString::null, Qt::WindowFlags fl = QgisGui::ModalDialogFlags );

~QgsPgNewConnection();
//! Tests the connection using the parameters supplied
void testConnection();
public slots:
@@ -40,10 +40,6 @@ QgsPgTableModel::QgsPgTableModel()
setHorizontalHeaderLabels( headerLabels );
}

QgsPgTableModel::~QgsPgTableModel()
{
}

void QgsPgTableModel::addTableEntry( const QgsPostgresLayerProperty& layerProperty )
{
QgsDebugMsg( layerProperty.toString() );
@@ -31,7 +31,6 @@ class QgsPgTableModel : public QStandardItemModel
Q_OBJECT
public:
QgsPgTableModel();
~QgsPgTableModel();

//! Adds entry for one database table to the model
void addTableEntry( const QgsPostgresLayerProperty& property );

0 comments on commit db5dd85

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