Skip to content

Commit

Permalink
handle min()/max() macros offending std::numeric_limits<T>::min()/max…
Browse files Browse the repository at this point in the history
…() on MSVC in one spot
  • Loading branch information
jef-n committed Aug 18, 2012
1 parent a38ce73 commit 24603ea
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 29 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Expand Up @@ -289,6 +289,8 @@ ENDIF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo
IF(MSVC)
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DQGISDEBUG=1")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DQGISDEBUG=1")
# disable macros that offend std::numeric_limits<T>::min()/max()
ADD_DEFINITIONS(-DNOMINMAX)
ENDIF(MSVC)

#############################################################
Expand Down
7 changes: 0 additions & 7 deletions python/CMakeLists.txt
Expand Up @@ -39,13 +39,6 @@ INCLUDE_DIRECTORIES(
${CMAKE_BINARY_DIR} # qgsconfig.h, qgsversion.h
)


# In Windef.h there are min() and max() macros that interfere with the usage
# of std::numeric_limits<T>::min() and :max() in qgsrasterbands.h.
IF(MSVC)
ADD_DEFINITIONS(-DNOMINMAX)
ENDIF(MSVC)

IF(PYQT4_VERSION_NUM LESS 263680) # 0x040600
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} PROXY_FACTORY)
ENDIF(PYQT4_VERSION_NUM LESS 263680)
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsattributetabledialog.cpp
Expand Up @@ -707,7 +707,7 @@ void QgsAttributeTableDialog::on_mAddAttribute_clicked()
mLayer->destroyEditCommand();
}
// update model - a field has been added or updated
mModel->reload( mModel->index( 0, 0 ), mModel->index( mModel->rowCount() - 1, mModel->columnCount() - 1 ) );\
mModel->reload( mModel->index( 0, 0 ), mModel->index( mModel->rowCount() - 1, mModel->columnCount() - 1 ) );
columnBoxInit();
}
}
Expand Down
9 changes: 0 additions & 9 deletions src/core/gps/qgsgpsdetector.h
Expand Up @@ -22,15 +22,6 @@
#include <QList>
#include <QPair>

#ifdef _MSC_VER
// qextserialport.h includes windows.h,
// which defines min()/max() macros w/o NOMINMAX,
// which in turn breaks limits std::numeric_limits<T>::min()/max()
#ifndef NOMINMAX
#define NOMINMAX
#endif
#endif

#include "qextserialport.h"

class QgsGPSConnection;
Expand Down
17 changes: 5 additions & 12 deletions src/core/raster/qgsrasterlayer.cpp
Expand Up @@ -82,14 +82,6 @@ email : tim at linfiniti.com
typedef void buildsupportedrasterfilefilter_t( QString & theFileFiltersString );
typedef bool isvalidrasterfilename_t( QString const & theFileNameQString, QString & retErrMsg );

// workaround for MSVC compiler which already has defined macro max
// that interferes with calling std::numeric_limits<int>::max
#ifdef _MSC_VER
# ifdef max
# undef max
# endif
#endif

// Comparison value for equality; i.e., we shouldn't directly compare two
// floats so it's better to take their difference and see if they're within
// a certain range -- in this case twenty times the smallest value that
Expand Down Expand Up @@ -339,6 +331,7 @@ int QgsRasterLayer::bandNumber( QString const & theBandName ) const
return 0; //no band was found
}

#if 0
/**
* Private method to calculate statistics for a band. Populates rasterStatsMemArray.
* Calculates:
Expand All @@ -358,7 +351,6 @@ int QgsRasterLayer::bandNumber( QString const & theBandName ) const
* @sa RasterBandStats
* @note This is a cpu intensive and slow task!
*/
/*
const QgsRasterBandStats QgsRasterLayer::bandStatistics( int theBandNo )
{
QgsDebugMsg( "theBandNo = " + QString::number( theBandNo ) );
Expand Down Expand Up @@ -431,7 +423,7 @@ const QgsRasterBandStats QgsRasterLayer::bandStatistics( QString const & theBand

return QgsRasterBandStats(); // return a null one
}
*/
#endif

QString QgsRasterLayer::buildPyramids( RasterPyramidList const & theRasterPyramidList,
QString const & theResamplingMethod, bool theTryInternalFlag )
Expand Down Expand Up @@ -2234,8 +2226,8 @@ void QgsRasterLayer::setRenderer( QgsRasterRenderer* theRenderer )
mPipe.set( theRenderer );
}

#if 0
// not sure if we want it
/*
void QgsRasterLayer::setResampleFilter( QgsRasterResampleFilter* resampleFilter )
{
QgsDebugMsg( "Entered" );
Expand All @@ -2246,7 +2238,8 @@ void QgsRasterLayer::setResampleFilter( QgsRasterResampleFilter* resampleFilter
QgsDebugMsg( "Cannot set resample filter." );
}
}
*/
#endif

void QgsRasterLayer::showProgress( int theValue )
{
emit progressUpdate( theValue );
Expand Down

0 comments on commit 24603ea

Please sign in to comment.