Skip to content

Commit

Permalink
avoid some compiler warnings on Windows
Browse files Browse the repository at this point in the history
The ERROR macro is already defined by WinGDI.h and so the warning C4005 'macro redefinition' was thrown.
The constant 0xFE is out of range for (signed) 'char' and so the warning C4309 'truncation of constant value' was thrown.
  • Loading branch information
SebDieBln committed Dec 25, 2015
1 parent 2415e37 commit 7ccbe1b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/providers/grass/qgsgrassrasterprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <QHash>

#define ERR(message) QGS_ERROR_MESSAGE(message,"GRASS provider")
#define ERROR(message) QgsError(message,"GRASS provider")
#define QGS_ERROR(message) QgsError(message,"GRASS provider")

// Do not use warning dialogs, providers are also created on threads (rendering) where dialogs connot be used (constructing QPixmap icon)

Expand Down Expand Up @@ -473,7 +473,7 @@ QgsRasterIdentifyResult QgsGrassRasterProvider::identify( const QgsPoint & thePo

if ( theFormat != QgsRaster::IdentifyFormatValue )
{
return QgsRasterIdentifyResult( ERROR( tr( "Format not supported" ) ) );
return QgsRasterIdentifyResult( QGS_ERROR( tr( "Format not supported" ) ) );
}

if ( !extent().contains( thePoint ) )
Expand All @@ -490,7 +490,7 @@ QgsRasterIdentifyResult QgsGrassRasterProvider::identify( const QgsPoint & thePo

if ( !ok )
{
return QgsRasterIdentifyResult( ERROR( tr( "Cannot read data" ) ) );
return QgsRasterIdentifyResult( QGS_ERROR( tr( "Cannot read data" ) ) );
}

// no data?
Expand Down
2 changes: 1 addition & 1 deletion src/providers/virtual/qgsvirtuallayerblob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void qgsGeometryToSpatialiteBlob( const QgsGeometry& geom, int32_t srid, char *&
p += wkb_size - 1;

// end marker
*p = 0xFE;
*p = '\xFE';
}

//
Expand Down
8 changes: 4 additions & 4 deletions src/providers/wcs/qgswcsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

#define ERR(message) QGS_ERROR_MESSAGE(message,"WCS provider")
#define SRVERR(message) QGS_ERROR_MESSAGE(message,"WCS server")
#define ERROR(message) QgsError(message,"WCS provider")
#define QGS_ERROR(message) QgsError(message,"WCS provider")

static QString WCS_KEY = "wcs";
static QString WCS_DESCRIPTION = "OGC Web Coverage Service version 1.0/1.1 data provider";
Expand Down Expand Up @@ -1370,7 +1370,7 @@ QgsRasterIdentifyResult QgsWcsProvider::identify( const QgsPoint & thePoint, Qgs

if ( theFormat != QgsRaster::IdentifyFormatValue )
{
return QgsRasterIdentifyResult( ERROR( tr( "Format not supported" ) ) );
return QgsRasterIdentifyResult( QGS_ERROR( tr( "Format not supported" ) ) );
}

if ( !extent().contains( thePoint ) )
Expand Down Expand Up @@ -1491,7 +1491,7 @@ QgsRasterIdentifyResult QgsWcsProvider::identify( const QgsPoint & thePoint, Qgs
if ( !mCachedGdalDataset ||
!mCachedViewExtent.contains( thePoint ) )
{
return QgsRasterIdentifyResult( ERROR( tr( "Read data error" ) ) );
return QgsRasterIdentifyResult( QGS_ERROR( tr( "Read data error" ) ) );
}

double x = thePoint.x();
Expand All @@ -1518,7 +1518,7 @@ QgsRasterIdentifyResult QgsWcsProvider::identify( const QgsPoint & thePoint, Qgs
if ( err != CPLE_None )
{
QgsLogger::warning( "RasterIO error: " + QString::fromUtf8( CPLGetLastErrorMsg() ) );
return QgsRasterIdentifyResult( ERROR( tr( "RasterIO error: " ) + QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
return QgsRasterIdentifyResult( QGS_ERROR( tr( "RasterIO error: " ) + QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
}

// Apply no data and user no data
Expand Down
8 changes: 4 additions & 4 deletions src/providers/wms/qgswmsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
#endif

#define ERR(message) QGS_ERROR_MESSAGE(message,"WMS provider")
#define ERROR(message) QgsError(message,"WMS provider")
#define QGS_ERROR(message) QgsError(message,"WMS provider")

static QString WMS_KEY = "wms";
static QString WMS_DESCRIPTION = "OGC Web Map Service version 1.3 data provider";
Expand Down Expand Up @@ -2047,7 +2047,7 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPoint & thePoint, Qgs
format = mCaps.mIdentifyFormats.value( theFormat );
if ( format.isEmpty() )
{
return QgsRasterIdentifyResult( ERROR( tr( "Format not supported" ) ) );
return QgsRasterIdentifyResult( QGS_ERROR( tr( "Format not supported" ) ) );
}

QgsDebugMsg( QString( "theFormat = %1 format = %2" ).arg( theFormat ).arg( format ) );
Expand All @@ -2067,7 +2067,7 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPoint & thePoint, Qgs
// are not, because we don't know original resolution
if ( theWidth == 0 || theHeight == 0 )
{
return QgsRasterIdentifyResult( ERROR( tr( "Context not fully specified (extent was defined but width and/or height was not)." ) ) );
return QgsRasterIdentifyResult( QGS_ERROR( tr( "Context not fully specified (extent was defined but width and/or height was not)." ) ) );
}
}
else // context (theExtent, theWidth, theHeight) not defined
Expand Down Expand Up @@ -2620,7 +2620,7 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPoint & thePoint, Qgs
// Report it as error so that user can switch to another format in results dialog.
if ( xsdPart < 0 && !featureTypeNames.isEmpty() && featureStoreList.isEmpty() )
{
QgsError err = ERROR( tr( "Cannot identify" ) );
QgsError err = QGS_ERROR( tr( "Cannot identify" ) );
err.append( tr( "Result parsing failed. %1 feature types were guessed from gml (%2) but no features were parsed." ).arg( featureTypeNames.size() ).arg( featureTypeNames.join( "," ) ) );
QgsDebugMsg( "parsing GML error: " + err.message() );
return QgsRasterIdentifyResult( err );
Expand Down

0 comments on commit 7ccbe1b

Please sign in to comment.