diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-08 17:01:49 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-11 07:35:43 +0100 |
commit | f14b9d30293f180500fc56d81e5390021758e7c1 (patch) | |
tree | a6cd0b853169203cfa0953230e6774e7b1dd81b4 /i18npool/source | |
parent | d11120b95ee27cb4b05db466ed07f7a996dda125 (diff) |
convert (a>b?a:b) to std::max(a,b)
with something like:
git grep -nP '(.*)\s*>\s*(.*)\s*\?\s*\g1\s*:\s*\g2'
Change-Id: I60b9a3a2a09162bc0de4c13fdde2c209696e5413
Reviewed-on: https://gerrit.libreoffice.org/47602
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool/source')
-rw-r--r-- | i18npool/source/breakiterator/xdictionary.cxx | 2 | ||||
-rw-r--r-- | i18npool/source/search/levdis.cxx | 9 | ||||
-rw-r--r-- | i18npool/source/textconversion/textconversionImpl.cxx | 6 |
3 files changed, 7 insertions, 10 deletions
diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx index 6ee5256328df..2619b350a189 100644 --- a/i18npool/source/breakiterator/xdictionary.cxx +++ b/i18npool/source/breakiterator/xdictionary.cxx @@ -350,7 +350,7 @@ WordBreakCache& xdictionary::getCache(const sal_Unicode *text, Boundary const & rCache.size = len; } else - rCache.size = len > DEFAULT_SIZE ? len : DEFAULT_SIZE; + rCache.size = std::max<sal_Int32>(len, DEFAULT_SIZE); rCache.contents = new sal_Unicode[rCache.size + 1]; rCache.wordboundary = new sal_Int32[rCache.size + 2]; } diff --git a/i18npool/source/search/levdis.cxx b/i18npool/source/search/levdis.cxx index 60970fe402d9..6d8330af3852 100644 --- a/i18npool/source/search/levdis.cxx +++ b/i18npool/source/search/levdis.cxx @@ -56,6 +56,7 @@ */ #include <string.h> +#include <algorithm> #if defined( _MSC_VER ) #pragma warning(once: 4068) @@ -63,10 +64,6 @@ #include "levdis.hxx" -#ifdef __sun -#undef min -#endif - #define LEVDISBIG (nLimit + 1) // Return value if distance > nLimit #define LEVDISDOUBLEBUF 2048 // no doubling atop this border @@ -340,9 +337,9 @@ int WLevDistance::Mid3( int x, int y, int z ) int WLevDistance::Max3( int x, int y, int z ) { if ( x > y ) - return( x > z ? x : z ); + return std::max(x, z); else - return( y > z ? y : z ); + return std::max(y, z); } // initialize data from CTOR diff --git a/i18npool/source/textconversion/textconversionImpl.cxx b/i18npool/source/textconversion/textconversionImpl.cxx index ea81ff3f19c7..990e59f112b4 100644 --- a/i18npool/source/textconversion/textconversionImpl.cxx +++ b/i18npool/source/textconversion/textconversionImpl.cxx @@ -37,7 +37,7 @@ TextConversionImpl::getConversions( const OUString& aText, sal_Int32 nStartPos, sal_Int32 len = aText.getLength() - nStartPos; if (nLength > len) - nLength = len > 0 ? len : 0; + nLength = std::max<sal_Int32>(len, 0); return xTC->getConversions(aText, nStartPos, nLength, rLocale, nConversionType, nConversionOptions); } @@ -49,7 +49,7 @@ TextConversionImpl::getConversion( const OUString& aText, sal_Int32 nStartPos, s sal_Int32 len = aText.getLength() - nStartPos; if (nLength > len) - nLength = len > 0 ? len : 0; + nLength = std::max<sal_Int32>(len, 0); return xTC->getConversion(aText, nStartPos, nLength, rLocale, nConversionType, nConversionOptions); } @@ -61,7 +61,7 @@ TextConversionImpl::getConversionWithOffset( const OUString& aText, sal_Int32 nS sal_Int32 len = aText.getLength() - nStartPos; if (nLength > len) - nLength = len > 0 ? len : 0; + nLength = std::max<sal_Int32>(len, 0); return xTC->getConversionWithOffset(aText, nStartPos, nLength, rLocale, nConversionType, nConversionOptions, offset); } |