summaryrefslogtreecommitdiff
path: root/i18npool/source/search
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-11 08:47:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-15 07:26:17 +0100
commit7d8e94444d989d0ac4a4055b207726708e9ec0da (patch)
treece3e4a09ed7932496c4d901360ff23787c8f6e24 /i18npool/source/search
parent80fb8d406ced47e6a2089f0c8ba5c103d2fec91f (diff)
convert a<b?a:b to std::min(a,b)
with something like git grep -nP '(.*)\s*<\s*(.*)\s*\?\s*\g1\s*:\s*\g2' -- *.?xx Change-Id: Id5078b35961847feb78a66204fdb7598ee63fd23 Note: we also convert a>b?b:a Reviewed-on: https://gerrit.libreoffice.org/47736 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool/source/search')
-rw-r--r--i18npool/source/search/levdis.cxx10
-rw-r--r--i18npool/source/search/textsearch.cxx4
2 files changed, 7 insertions, 7 deletions
diff --git a/i18npool/source/search/levdis.cxx b/i18npool/source/search/levdis.cxx
index 7795cf7bc168..9e4d9afe527c 100644
--- a/i18npool/source/search/levdis.cxx
+++ b/i18npool/source/search/levdis.cxx
@@ -316,9 +316,9 @@ int WLevDistance::LCM( int a, int b )
inline int WLevDistance::Min3( int x, int y, int z )
{
if ( x < y )
- return( x < z ? x : z );
+ return std::min(x, z);
else
- return( y < z ? y : z );
+ return std::min(y, z);
}
// The value in the middle
@@ -326,11 +326,11 @@ int WLevDistance::Mid3( int x, int y, int z )
{
int min = Min3(x,y,z);
if ( x == min )
- return( y < z ? y : z);
+ return std::min(y, z);
else if ( y == min )
- return( x < z ? x : z);
+ return std::min(x, z);
else // z == min
- return( x < y ? x : y);
+ return std::min(x, y);
}
// Maximum of three values
diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx
index 6f51d3b2cbf0..a2c20342bee3 100644
--- a/i18npool/source/search/textsearch.cxx
+++ b/i18npool/source/search/textsearch.cxx
@@ -1062,7 +1062,7 @@ SearchResult TextSearch::ApproxSrchFrwrd( const OUString& searchStr,
if( aWBnd.startPos >= endPos )
break;
nStt = aWBnd.startPos < startPos ? startPos : aWBnd.startPos;
- nEnd = aWBnd.endPos > endPos ? endPos : aWBnd.endPos;
+ nEnd = std::min(aWBnd.endPos, endPos);
if( nStt < nEnd &&
pWLD->WLD( searchStr.getStr() + nStt, nEnd - nStt ) <= nLimit )
@@ -1106,7 +1106,7 @@ SearchResult TextSearch::ApproxSrchBkwrd( const OUString& searchStr,
if( aWBnd.endPos <= endPos )
break;
nStt = aWBnd.startPos < endPos ? endPos : aWBnd.startPos;
- nEnd = aWBnd.endPos > startPos ? startPos : aWBnd.endPos;
+ nEnd = std::min(aWBnd.endPos, startPos);
if( nStt < nEnd &&
pWLD->WLD( searchStr.getStr() + nStt, nEnd - nStt ) <= nLimit )