diff options
author | Marcos Paulo de Souza <marcos.souza.org@gmail.com> | 2013-04-11 00:21:40 -0300 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2013-04-20 11:09:54 +0000 |
commit | 0f200cc30ea75fdce59f7bb6ae87ebc85729e2a4 (patch) | |
tree | 2e2c28f9500f81825cdadcbabd131da767ddbb49 /tools | |
parent | 5414a3eecdb09be928313477792acfe1d3534645 (diff) |
fdo#63154: Change Min/Max/Abs for std::min/max/abs
Now all these usages were removed from LO.
Change-Id: I8a7233db20abdcdbb18428ad4004c78cc516a0e6
Reviewed-on: https://gerrit.libreoffice.org/3326
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/inc/tools/gen.hxx | 12 | ||||
-rw-r--r-- | tools/inc/tools/solar.h | 15 | ||||
-rw-r--r-- | tools/source/datetime/ttime.cxx | 4 | ||||
-rw-r--r-- | tools/source/generic/fract.cxx | 12 | ||||
-rw-r--r-- | tools/source/generic/gen.cxx | 16 | ||||
-rw-r--r-- | tools/source/generic/poly.cxx | 10 |
6 files changed, 27 insertions, 42 deletions
diff --git a/tools/inc/tools/gen.hxx b/tools/inc/tools/gen.hxx index 028d5043f845..19d10bd96af5 100644 --- a/tools/inc/tools/gen.hxx +++ b/tools/inc/tools/gen.hxx @@ -498,8 +498,8 @@ inline Point Rectangle::TopCenter() const if ( IsEmpty() ) return Point( nLeft, nTop ); else - return Point( Min( nLeft, nRight ) + Abs( (nRight - nLeft)/2 ), - Min( nTop, nBottom) ); + return Point( std::min( nLeft, nRight ) + std::abs( (nRight - nLeft)/2 ), + std::min( nTop, nBottom) ); } inline Point Rectangle::BottomCenter() const @@ -507,8 +507,8 @@ inline Point Rectangle::BottomCenter() const if ( IsEmpty() ) return Point( nLeft, nTop ); else - return Point( Min( nLeft, nRight ) + Abs( (nRight - nLeft)/2 ), - Max( nTop, nBottom) ); + return Point( std::min( nLeft, nRight ) + std::abs( (nRight - nLeft)/2 ), + std::max( nTop, nBottom) ); } inline Point Rectangle::LeftCenter() const @@ -516,7 +516,7 @@ inline Point Rectangle::LeftCenter() const if ( IsEmpty() ) return Point( nLeft, nTop ); else - return Point( Min( nLeft, nRight ), nTop + (nBottom - nTop)/2 ); + return Point( std::min( nLeft, nRight ), nTop + (nBottom - nTop)/2 ); } inline Point Rectangle::RightCenter() const @@ -524,7 +524,7 @@ inline Point Rectangle::RightCenter() const if ( IsEmpty() ) return Point( nLeft, nTop ); else - return Point( Max( nLeft, nRight ), nTop + (nBottom - nTop)/2 ); + return Point( std::max( nLeft, nRight ), nTop + (nBottom - nTop)/2 ); } inline Point Rectangle::Center() const diff --git a/tools/inc/tools/solar.h b/tools/inc/tools/solar.h index ece2f8976ddf..58d5849c5f42 100644 --- a/tools/inc/tools/solar.h +++ b/tools/inc/tools/solar.h @@ -107,21 +107,6 @@ inline void DoubleToSVBT64( double n, SVBT64 p ) { p[0] = ((sal_uInt8*)&n)[7 #endif #endif -#ifndef __cplusplus -#ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif -#endif - -#ifdef __cplusplus -template<typename T> inline T Min(T a, T b) { return (a<b?a:b); } -template<typename T> inline T Max(T a, T b) { return (a>b?a:b); } -template<typename T> inline T Abs(T a) { return (a>=0?a:-a); } -#endif - #ifdef __cplusplus #define EXTERN_C extern "C" #else diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx index 9f1241cfd76b..8b27d1ffa72d 100644 --- a/tools/source/datetime/ttime.cxx +++ b/tools/source/datetime/ttime.cxx @@ -343,7 +343,7 @@ Time Time::GetUTCOffset() nTempTime += aTimeZone.StandardBias; else if ( nTimeZoneRet == TIME_ZONE_ID_DAYLIGHT ) nTempTime += aTimeZone.DaylightBias; - Time aTime( 0, (sal_uInt16)Abs( nTempTime ) ); + Time aTime( 0, (sal_uInt16)abs( nTempTime ) ); if ( nTempTime > 0 ) aTime = -aTime; return aTime; @@ -381,7 +381,7 @@ Time Time::GetUTCOffset() nCacheSecOffset = (nLocalTime-nUTC) / 60; } - nTempTime = (short)Abs( nCacheSecOffset ); + nTempTime = abs( nCacheSecOffset ); Time aTime( 0, (sal_uInt16)nTempTime ); if ( nCacheSecOffset < 0 ) aTime = -aTime; diff --git a/tools/source/generic/fract.cxx b/tools/source/generic/fract.cxx index 5c805dc7dcd1..4f5ee96a4cd3 100644 --- a/tools/source/generic/fract.cxx +++ b/tools/source/generic/fract.cxx @@ -35,8 +35,8 @@ */ static long GetGGT( long nVal1, long nVal2 ) { - nVal1 = Abs( nVal1 ); - nVal2 = Abs( nVal2 ); + nVal1 = std::abs( nVal1 ); + nVal2 = std::abs( nVal2 ); if ( nVal1 <= 1 || nVal2 <= 1 ) return 1; @@ -132,7 +132,7 @@ Fraction::Fraction( double dVal ) return; } - while ( Abs( (long)dVal ) < nMAX && nDen < nMAX ) + while ( abs( (long)dVal ) < nMAX && nDen < nMAX ) { dVal *= 10; nDen *= 10; @@ -411,10 +411,10 @@ void Fraction::ReduceInaccurate( unsigned nSignificantBits ) DBG_ASSERT(nSignificantBits<65, "More than 64 bit of significance is overkill!"); // How much bits can we lose? - const int nMulBitsToLose = Max( ( impl_NumberOfBits( nMul ) - int( nSignificantBits ) ), 0 ); - const int nDivBitsToLose = Max( ( impl_NumberOfBits( nDiv ) - int( nSignificantBits ) ), 0 ); + const int nMulBitsToLose = std::max( ( impl_NumberOfBits( nMul ) - int( nSignificantBits ) ), 0 ); + const int nDivBitsToLose = std::max( ( impl_NumberOfBits( nDiv ) - int( nSignificantBits ) ), 0 ); - const int nToLose = Min( nMulBitsToLose, nDivBitsToLose ); + const int nToLose = std::min( nMulBitsToLose, nDivBitsToLose ); // Remove the bits nMul >>= nToLose; diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx index e4a03a318f1f..d7d7ff0403e8 100644 --- a/tools/source/generic/gen.cxx +++ b/tools/source/generic/gen.cxx @@ -70,10 +70,10 @@ Rectangle& Rectangle::Union( const Rectangle& rRect ) *this = rRect; else { - nLeft = Min( Min( nLeft, rRect.nLeft ), Min( nRight, rRect.nRight ) ); - nRight = Max( Max( nLeft, rRect.nLeft ), Max( nRight, rRect.nRight ) ); - nTop = Min( Min( nTop, rRect.nTop ), Min( nBottom, rRect.nBottom ) ); - nBottom = Max( Max( nTop, rRect.nTop ), Max( nBottom, rRect.nBottom ) ); + nLeft = std::min( std::min( nLeft, rRect.nLeft ), std::min( nRight, rRect.nRight ) ); + nRight = std::max( std::max( nLeft, rRect.nLeft ), std::max( nRight, rRect.nRight ) ); + nTop = std::min( std::min( nTop, rRect.nTop ), std::min( nBottom, rRect.nBottom ) ); + nBottom = std::max( std::max( nTop, rRect.nTop ), std::max( nBottom, rRect.nBottom ) ); } return *this; @@ -95,10 +95,10 @@ Rectangle& Rectangle::Intersection( const Rectangle& rRect ) aTmpRect.Justify(); // Perform intersection - nLeft = Max( nLeft, aTmpRect.nLeft ); - nRight = Min( nRight, aTmpRect.nRight ); - nTop = Max( nTop, aTmpRect.nTop ); - nBottom= Min( nBottom, aTmpRect.nBottom ); + nLeft = std::max( nLeft, aTmpRect.nLeft ); + nRight = std::min( nRight, aTmpRect.nRight ); + nTop = std::max( nTop, aTmpRect.nTop ); + nBottom= std::min( nBottom, aTmpRect.nBottom ); // Determine if intersection is empty if ( nRight < nLeft || nBottom < nTop ) diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index dfa931a2433d..661854cd2e76 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -363,8 +363,8 @@ Polygon::Polygon( const Rectangle& rRect, sal_uIntPtr nHorzRound, sal_uIntPtr nV Rectangle aRect( rRect ); aRect.Justify(); // SJ: i9140 - nHorzRound = Min( nHorzRound, (sal_uIntPtr) labs( aRect.GetWidth() >> 1 ) ); - nVertRound = Min( nVertRound, (sal_uIntPtr) labs( aRect.GetHeight() >> 1 ) ); + nHorzRound = std::min( nHorzRound, (sal_uIntPtr) labs( aRect.GetWidth() >> 1 ) ); + nVertRound = std::min( nVertRound, (sal_uIntPtr) labs( aRect.GetHeight() >> 1 ) ); if( !nHorzRound && !nVertRound ) { @@ -500,7 +500,7 @@ Polygon::Polygon( const Rectangle& rBound, const Point& rStart, const Point& rEn fDiff = F_2PI; // Proportionally shrink number of points( fDiff / (2PI) ); - nPoints = Max( (sal_uInt16) ( ( fDiff * 0.1591549 ) * nPoints ), (sal_uInt16) 16 ); + nPoints = std::max( (sal_uInt16) ( ( fDiff * 0.1591549 ) * nPoints ), (sal_uInt16) 16 ); fStep = fDiff / ( nPoints - 1 ); if( POLY_PIE == eStyle ) @@ -1200,7 +1200,7 @@ Point ImplEdgePointFilter::EdgeSection( const Point& rPoint, int nEdge ) const long dy = nNewY - ly; if ( !md ) nNewX = lx; - else if ( (LONG_MAX / Abs(md)) >= Abs(dy) ) + else if ( (LONG_MAX / std::abs(md)) >= std::abs(dy) ) nNewX = (dy * md) / mn + lx; else { @@ -1226,7 +1226,7 @@ Point ImplEdgePointFilter::EdgeSection( const Point& rPoint, int nEdge ) const long dx = nNewX - lx; if ( !mn ) nNewY = ly; - else if ( (LONG_MAX / Abs(mn)) >= Abs(dx) ) + else if ( (LONG_MAX / std::abs(mn)) >= std::abs(dx) ) nNewY = (dx * mn) / md + ly; else { |