Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Sep 17, 2020
1 parent 8ee86d0 commit 934d81c
Show file tree
Hide file tree
Showing 19 changed files with 43 additions and 50 deletions.
4 changes: 4 additions & 0 deletions external/nmea/time.c
Expand Up @@ -29,13 +29,17 @@
#include "nmeatime.h"

#ifdef NMEA_WIN
#ifdef _MSC_VER
# pragma warning(disable: 4201)
# pragma warning(disable: 4214)
# pragma warning(disable: 4115)
#endif
# include <windows.h>
#ifdef _MSC_VER
# pragma warning(default: 4201)
# pragma warning(default: 4214)
# pragma warning(default: 4115)
#endif
#else
# include <time.h>
#endif
Expand Down
2 changes: 2 additions & 0 deletions external/poly2tri/common/utils.h
Expand Up @@ -33,7 +33,9 @@
#define UTILS_H

// Otherwise #defines like M_PI are undeclared under Visual Studio
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif

#include "shapes.h"

Expand Down
2 changes: 1 addition & 1 deletion external/rtree/include/RTree.h
Expand Up @@ -749,7 +749,7 @@ class RTree
ElementTypeReal increase;
ElementTypeReal bestIncr = CastElementTypeReal(-1);
ElementTypeReal area;
ElementTypeReal bestArea;
ElementTypeReal bestArea = CastElementTypeReal(-1);
int best = 0;
Rect tempRect;

Expand Down
2 changes: 1 addition & 1 deletion src/3d/qgsshadowrenderingframegraph.h
Expand Up @@ -150,7 +150,7 @@ class QgsShadowRenderingFrameGraph
Qt3DRender::QCamera *mLightCamera = nullptr;
Qt3DRender::QCameraSelector *mLightCameraSelector = nullptr;
bool mShadowRenderingEnabled = false;
float mShadowBias = 0.00001;
float mShadowBias = 0.00001f;
int mShadowMapResolution = 2048;

Qt3DRender::QLayerFilter *mShadowSceneEntitiesFilter = nullptr;
Expand Down
1 change: 0 additions & 1 deletion src/3d/symbols/qgsline3dsymbol.cpp
Expand Up @@ -126,5 +126,4 @@ bool QgsLine3DSymbol::exportGeometries( Qgs3DSceneExporter *exporter, Qt3DCore::
}
return renderers.size() != 0;
}
return false;
}
2 changes: 0 additions & 2 deletions src/analysis/CMakeLists.txt
Expand Up @@ -386,7 +386,6 @@ ADD_BISON_FILES_PREFIX(QGIS_ANALYSIS_SRCS raster raster/qgsrastercalcparser.yy)
IF(NOT MSVC)
SET_SOURCE_FILES_PROPERTIES(
${CMAKE_BINARY_DIR}/src/analysis/qgsrastercalcparser.cpp
${CMAKE_BINARY_DIR}/src/analysis/qgsmeshcalcparser.cpp
PROPERTIES COMPILE_FLAGS "-w"
)
ELSE(NOT MSVC)
Expand All @@ -395,7 +394,6 @@ ELSE(NOT MSVC)
# 4702 unreachable code
SET_SOURCE_FILES_PROPERTIES(
${CMAKE_BINARY_DIR}/src/analysis/qgsrastercalcparser.cpp
${CMAKE_BINARY_DIR}/src/analysis/qgsmeshcalcparser.cpp
PROPERTIES COMPILE_FLAGS "-wd4127 -wd4702"
)
ENDIF(PEDANTIC)
Expand Down
8 changes: 6 additions & 2 deletions src/core/CMakeLists.txt
Expand Up @@ -753,13 +753,18 @@ ADD_BISON_FILES_PREFIX(QGIS_CORE_SRCS sqlstatement_ qgssqlstatementparser.yy)
ADD_BISON_FILES_PREFIX(QGIS_CORE_SRCS mesh mesh/qgsmeshcalcparser.yy)

IF(NOT MSVC)
SET_SOURCE_FILES_PROPERTIES(qgsexpressionparser.cpp qgssqlstatementparser.cpp qgsmeshcalcparser.cpp PROPERTIES COMPILE_FLAGS -w)
SET_SOURCE_FILES_PROPERTIES(
qgsexpressionparser.cpp
qgssqlstatementparser.cpp
qgsmeshcalcparser.cpp
PROPERTIES COMPILE_FLAGS -w)
ELSE(NOT MSVC)
# -wd4702 unreachable code
SET_SOURCE_FILES_PROPERTIES(
geometry/qgsgeos.cpp
pal/feature.cpp
pal/pointset.cpp
${CMAKE_BINARY_DIR}/src/core/qgsmeshcalcparser.cpp
PROPERTIES COMPILE_FLAGS -wd4702)
ENDIF(NOT MSVC)

Expand Down Expand Up @@ -1520,7 +1525,6 @@ ELSE (MSVC)
SET_SOURCE_FILES_PROPERTIES(${VECTOR_TILE_PROTO_SRCS} PROPERTIES COMPILE_FLAGS -w)
ENDIF (MSVC)


# install headers
# install qgsconfig.h and plugin.h here so they can get into
# the OS X framework target
Expand Down
11 changes: 2 additions & 9 deletions src/core/expression/qgsexpressionfunction.cpp
Expand Up @@ -442,17 +442,10 @@ static QVariant fcnRnd( const QVariantList &values, const QgsExpressionContext *

qint64 randomInteger = min + ( generator() % ( max - min + 1 ) );
if ( randomInteger > std::numeric_limits<int>::max() || randomInteger < -std::numeric_limits<int>::max() )
{
return QVariant( randomInteger );
}
else
{
// Prevent wrong conversion of QVariant. See #36412
return QVariant( int( randomInteger ) );
}

// Return a random integer in the range [min, max] (inclusive)
return QVariant( min + ( generator() % ( max - min + 1 ) ) );
// Prevent wrong conversion of QVariant. See #36412
return QVariant( int( randomInteger ) );
}

static QVariant fcnLinearScale( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent, const QgsExpressionNodeFunction * )
Expand Down
11 changes: 6 additions & 5 deletions src/core/qgsabstractgeopdfexporter.cpp
Expand Up @@ -155,8 +155,9 @@ bool QgsAbstractGeoPdfExporter::compositionModeSupported( QPainter::CompositionM
return true;

default:
return false;
break;
}

return false;
}

Expand Down Expand Up @@ -627,10 +628,10 @@ QString QgsAbstractGeoPdfExporter::compositionModeToString( QPainter::Compositio
return QStringLiteral( "Exclusion" );

default:
QgsDebugMsg( QStringLiteral( "Unsupported PDF blend mode %1" ).arg( mode ) );
return QStringLiteral( "Normal" );

break;
}
return QString();

QgsDebugMsg( QStringLiteral( "Unsupported PDF blend mode %1" ).arg( mode ) );
return QStringLiteral( "Normal" );
}

2 changes: 2 additions & 0 deletions src/core/qgsapplication.cpp
Expand Up @@ -98,8 +98,10 @@
#include <lmcons.h>
#define SECURITY_WIN32
#include <security.h>
#ifdef _MSC_VER
#pragma comment( lib, "Secur32.lib" )
#endif
#endif

#include "qgsconfig.h"

Expand Down
5 changes: 3 additions & 2 deletions src/core/qgsdatabasetablemodel.cpp
Expand Up @@ -131,9 +131,10 @@ QVariant QgsDatabaseTableModel::data( const QModelIndex &index, int role ) const
return QgsLayerItem::iconLine();
}
default:
return QgsLayerItem::iconTable();
break;
}
return QVariant();

return QgsLayerItem::iconTable();
}
else if ( role == RoleWkbType )
return table.geometryColumnTypes().at( 0 ).wkbType;
Expand Down
3 changes: 2 additions & 1 deletion src/core/qgsogrutils.cpp
Expand Up @@ -810,8 +810,9 @@ QString QgsOgrUtils::readShapefileEncodingFromCpg( const QString &path )
}
}
}
#endif

return QString();
#endif
}

QString QgsOgrUtils::readShapefileEncodingFromLdid( const QString &path )
Expand Down
1 change: 1 addition & 0 deletions src/core/vectortile/qgsvectortileloader.cpp
Expand Up @@ -165,6 +165,7 @@ QList<QgsVectorTileRawData> QgsVectorTileLoader::blockingFetchTileRawData( const
if ( !isUrl )
{
bool res = mbReader.open();
Q_UNUSED( res );
Q_ASSERT( res );
}

Expand Down
1 change: 1 addition & 0 deletions src/core/vectortile/qgsvectortileutils.cpp
Expand Up @@ -112,6 +112,7 @@ QgsVectorLayer *QgsVectorTileUtils::makeVectorLayerForTile( QgsVectorTileLayer *
vl->dataProvider()->addAttributes( fields.toList() );
vl->updateFields();
bool res = vl->dataProvider()->addFeatures( featuresList );
Q_UNUSED( res );
Q_ASSERT( res );
Q_ASSERT( featuresList.count() == vl->featureCount() );
vl->updateExtents();
Expand Down
9 changes: 2 additions & 7 deletions src/gui/layout/qgsgeopdflayertreemodel.cpp
Expand Up @@ -53,14 +53,9 @@ Qt::ItemFlags QgsGeoPdfLayerTreeModel::flags( const QModelIndex &idx ) const
}

if ( !mapLayer( idx ) )
{
return nullptr;
}
else
{
return Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsDragEnabled;
}
return Qt::NoItemFlags;

return Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemIsDragEnabled;
}

QgsMapLayer *QgsGeoPdfLayerTreeModel::mapLayer( const QModelIndex &idx ) const
Expand Down
5 changes: 0 additions & 5 deletions src/gui/processing/qgsprocessingmultipleselectiondialog.cpp
Expand Up @@ -37,14 +37,9 @@ QgsProcessingMultipleSelectionPanelWidget::QgsProcessingMultipleSelectionPanelWi
, mValueFormatter( []( const QVariant & v )->QString
{
if ( v.canConvert< QgsProcessingModelChildParameterSource >() )
{
return v.value< QgsProcessingModelChildParameterSource >().staticValue().toString();
}
else
{
return v.toString();
}
return QString();
} )
{
setupUi( this );
Expand Down
7 changes: 4 additions & 3 deletions src/providers/grass/qgsgrass.cpp
Expand Up @@ -54,6 +54,7 @@
#include <QTemporaryFile>
#include <QHash>
#include <QTextCodec>
#include <QElapsedTimer>


extern "C"
Expand Down Expand Up @@ -1478,7 +1479,7 @@ QStringList QgsGrass::elements( const QString &mapsetPath, const QString &elem
QStringList QgsGrass::grassObjects( const QgsGrassObject &mapsetObject, QgsGrassObject::Type type )
{
QgsDebugMsg( "mapsetPath = " + mapsetObject.mapsetPath() + " type = " + QgsGrassObject::elementShort( type ) );
QTime time;
QElapsedTimer time;
time.start();
QStringList list;
if ( !QDir( mapsetObject.mapsetPath() ).isReadable() )
Expand Down Expand Up @@ -1997,7 +1998,7 @@ QByteArray QgsGrass::runModule( const QString &gisdbase, const QString &locatio
const QStringList &arguments, int timeOut, bool qgisModule )
{
QgsDebugMsg( QString( "gisdbase = %1 location = %2 timeOut = %3" ).arg( gisdbase, location ).arg( timeOut ) );
QTime time;
QElapsedTimer time;
time.start();

QTemporaryFile gisrcFile;
Expand Down Expand Up @@ -2888,7 +2889,7 @@ QgsGrass::ModuleOutput QgsGrass::parseModuleOutput( const QString &input, QStrin
for ( int i = 0; i < input.size(); i++ )
{
int c = input.at( i ).toLatin1();
ascii += QString().sprintf( "%2x ", c );
ascii += QStringLiteral( "%1 " ).arg( c, 0, 16 );
}
QgsDebugMsg( "ascii = " + ascii );
#endif
Expand Down
6 changes: 3 additions & 3 deletions src/providers/grass/qgsgrassprovider.cpp
Expand Up @@ -20,6 +20,7 @@

#include <QString>
#include <QDateTime>
#include <QElapsedTimer>

#include "qgis.h"
#include "qgsdataprovider.h"
Expand Down Expand Up @@ -114,7 +115,7 @@ QgsGrassProvider::QgsGrassProvider( const QString &uri )
return;
}

QTime time;
QElapsedTimer time;
time.start();

mPoints = Vect_new_line_struct();
Expand Down Expand Up @@ -953,8 +954,7 @@ QgsAttributeMap *QgsGrassProvider::attributes( int field, int cat )

dbString dbstr;
db_init_string( &dbstr );
QString query;
query.sprintf( "select * from %s where %s = %d", fi->table, fi->key, cat );
QString query = QStringLiteral( "select * from %1 where %2=%3" ).arg( fi->table, fi->key ).arg( cat );
db_set_string( &dbstr, query.toUtf8().constData() );

QgsDebugMsg( QString( "SQL: %1" ).arg( db_get_string( &dbstr ) ) );
Expand Down
11 changes: 3 additions & 8 deletions src/providers/wms/qgswmscapabilities.cpp
Expand Up @@ -437,15 +437,10 @@ QDateTime QgsWmsSettings::parseWmstDateTimes( QString item )
// Check if it does not have time part
if ( !item.contains( 'T' ) )
return QDateTime::fromString( item, "yyyy-MM-dd" );
else if ( item.contains( '.' ) )
return QDateTime::fromString( item, Qt::ISODateWithMs );
else
{
if ( item.contains( '.' ) )
return QDateTime::fromString( item, Qt::ISODateWithMs );
else
return QDateTime::fromString( item, Qt::ISODate );
}

return QDateTime::fromString( item, format );
return QDateTime::fromString( item, Qt::ISODate );
}


Expand Down

0 comments on commit 934d81c

Please sign in to comment.