From 688f27528b2daa5ee0f80866a9bb832ead521def Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Mon, 6 Jul 2015 17:43:38 +0200 Subject: [PATCH] fix some warnings and suppression warnings on windows --- CMakeLists.txt | 29 ++++++++++--------- src/providers/grass/qgis.d.rast.c | 2 +- src/providers/grass/qgis.r.in.cpp | 2 +- .../grass/qgsgrassrasterprovider.cpp | 2 +- src/server/qgswmsserver.cpp | 1 - 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae7294c87b2..5c56ff4fa7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -382,23 +382,26 @@ ENDIF() IF (PEDANTIC) MESSAGE (STATUS "Pedantic compiler settings enabled") IF(MSVC) + SET(_warnings "") IF (NOT USING_NMAKE) - ADD_DEFINITIONS( /W4 ) + SET(_warnings "${_warnings} /W4" ) ENDIF (NOT USING_NMAKE) # 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( /wd4244 ) # conversion from '...' to '...' possible loss of data - 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) + SET(_warnings "${_warnings} /wd4100 ") # unused formal parameters + SET(_warnings "${_warnings} /wd4127 ") # constant conditional expressions (used in Qt template classes) + SET(_warnings "${_warnings} /wd4231 ") # nonstandard extension used : 'identifier' before template explicit instantiation (used in Qt template classes) + SET(_warnings "${_warnings} /wd4244 ") # conversion from '...' to '...' possible loss of data + SET(_warnings "${_warnings} /wd4251 ") # needs to have dll-interface to be used by clients of class (occurs in Qt template classes) + SET(_warnings "${_warnings} /wd4275 ") # non dll-interface class '...' used as base for dll-interface class '...' + SET(_warnings "${_warnings} /wd4505 ") # unreferenced local function has been removed (QgsRasterDataProvider::extent) + SET(_warnings "${_warnings} /wd4510 ") # default constructor could not be generated (sqlite3_index_info, QMap) + SET(_warnings "${_warnings} /wd4512 ") # assignment operator could not be generated (sqlite3_index_info) + SET(_warnings "${_warnings} /wd4610 ") # user defined constructor required (sqlite3_index_info) + SET(_warnings "${_warnings} /wd4706 ") # assignment within conditional expression (pal) + SET(_warnings "${_warnings} /wd4800 ") # 'int' : forcing value to bool 'true' or 'false' (performance warning) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_warnings}") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_warnings}") 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") diff --git a/src/providers/grass/qgis.d.rast.c b/src/providers/grass/qgis.d.rast.c index 8370ac0bfa5..00061b18193 100644 --- a/src/providers/grass/qgis.d.rast.c +++ b/src/providers/grass/qgis.d.rast.c @@ -256,7 +256,7 @@ static int cell_draw( char *name, if ( data_type == CELL_TYPE ) { //int nul = -2000000000; - int nul = -2147483648; + int nul = INT_MIN; fwrite( &nul, 4, 1, fo ); } else if ( data_type == DCELL_TYPE ) diff --git a/src/providers/grass/qgis.r.in.cpp b/src/providers/grass/qgis.r.in.cpp index 52c97dd93c7..72a5c2b7145 100644 --- a/src/providers/grass/qgis.r.in.cpp +++ b/src/providers/grass/qgis.r.in.cpp @@ -155,7 +155,7 @@ int main( int argc, char **argv ) void *buf = G_allocate_raster_buf( grass_type ); int expectedSize = cols * QgsRasterBlock::typeSize( qgis_type ); - bool isCanceled; + bool isCanceled = false; QByteArray byteArray; for ( int row = 0; row < rows; row++ ) { diff --git a/src/providers/grass/qgsgrassrasterprovider.cpp b/src/providers/grass/qgsgrassrasterprovider.cpp index 54a7b8fef8c..27dadfbac7a 100644 --- a/src/providers/grass/qgsgrassrasterprovider.cpp +++ b/src/providers/grass/qgsgrassrasterprovider.cpp @@ -108,7 +108,7 @@ QgsGrassRasterProvider::QgsGrassRasterProvider( QString const & uri ) double myInternalNoDataValue; if ( mGrassDataType == CELL_TYPE ) { - myInternalNoDataValue = -2147483648; + myInternalNoDataValue = INT_MIN; } else if ( mGrassDataType == DCELL_TYPE ) { diff --git a/src/server/qgswmsserver.cpp b/src/server/qgswmsserver.cpp index b50c620075d..9cc09488035 100644 --- a/src/server/qgswmsserver.cpp +++ b/src/server/qgswmsserver.cpp @@ -1897,7 +1897,6 @@ int QgsWMSServer::configureMapRender( const QPaintDevice* paintDevice ) const { QgsDebugMsg( "Error, could not create output CRS from EPSG" ); throw QgsMapServiceException( "InvalidCRS", "Could not create output CRS" ); - return 5; } mMapRenderer->setDestinationCrs( outputCRS ); mMapRenderer->setProjectionsEnabled( true );