Skip to content
Permalink
Browse files

avoid some compiler warnings on Windows

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 7ccbe1bfc374a461db7a6e4d197f0308310bb46e
@@ -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)

@@ -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 ) )
@@ -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?
@@ -102,7 +102,7 @@ void qgsGeometryToSpatialiteBlob( const QgsGeometry& geom, int32_t srid, char *&
p += wkb_size - 1;

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

//
@@ -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";
@@ -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 ) )
@@ -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();
@@ -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
@@ -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";
@@ -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 ) );
@@ -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
@@ -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 );

0 comments on commit 7ccbe1b

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