summaryrefslogtreecommitdiff
path: root/sc/source/core/tool
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 /sc/source/core/tool
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 'sc/source/core/tool')
-rw-r--r--sc/source/core/tool/compiler.cxx2
-rw-r--r--sc/source/core/tool/dbdata.cxx2
-rw-r--r--sc/source/core/tool/interpr3.cxx2
-rw-r--r--sc/source/core/tool/reftokenhelper.cxx2
-rw-r--r--sc/source/core/tool/scmatrix.cxx2
5 files changed, 5 insertions, 5 deletions
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index a7b7b8d9629b..ba03e59ff95a 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -4111,7 +4111,7 @@ bool ScCompiler::NextNewToken( bool bInArray )
{
ScRawToken aToken;
aToken.SetOpCode( ocSpaces );
- aToken.sbyte.cByte = static_cast<sal_uInt8>( nSpaces > 255 ? 255 : nSpaces );
+ aToken.sbyte.cByte = static_cast<sal_uInt8>( std::min<sal_Int32>(nSpaces, 255) );
if( !static_cast<ScTokenArray*>(pArr)->AddRawToken( aToken ) )
{
SetError(FormulaError::CodeOverflow);
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index 633af20860b9..efb3f15671cf 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -678,7 +678,7 @@ void ScDBData::AdjustTableColumnNames( UpdateRefMode eUpdateRefMode, SCCOL nDx,
// nCol1 is the first column of the block that gets shifted, determine
// the head and tail elements that are to be copied for deletion or
// insertion.
- size_t nHead = static_cast<size_t>(::std::max( nCol1 + (nDx < 0 ? nDx : 0) - nOldCol1, 0));
+ size_t nHead = static_cast<size_t>(::std::max( nCol1 + std::min<SCCOL>(nDx, 0) - nOldCol1, 0));
size_t nTail = static_cast<size_t>(::std::max( nOldCol2 - nCol1 + 1, 0));
size_t n = nHead + nTail;
if (0 < n && n <= maTableColumnNames.size())
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 723c75d8139f..55b80a6612e9 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -1261,7 +1261,7 @@ double lcl_GetBinomDistRange(double n, double xs,double xe,
fFactor *= (n-i+1)/i * p/q;
fSum += fFactor;
}
- return (fSum>1.0) ? 1.0 : fSum;
+ return std::min(fSum,1.0);
}
void ScInterpreter::ScB()
diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx
index 1d792f7222c8..d1422f1ab266 100644
--- a/sc/source/core/tool/reftokenhelper.cxx
+++ b/sc/source/core/tool/reftokenhelper.cxx
@@ -300,7 +300,7 @@ private:
// These two ranges cannot be joined. Move on.
return false;
- T nMin = nMin1 < nMin2 ? nMin1 : nMin2;
+ T nMin = std::min(nMin1, nMin2);
T nMax = std::max(nMax1, nMax2);
rNewMin = nMin;
diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx
index 19d4b62394b6..d22fdd347e26 100644
--- a/sc/source/core/tool/scmatrix.cxx
+++ b/sc/source/core/tool/scmatrix.cxx
@@ -363,7 +363,7 @@ static size_t GetElementsMax( size_t nMemory )
// With MAXROWCOUNT==1048576 and 128 columns => 128M elements, 1.5GB
constexpr size_t nArbitraryLimit = size_t(MAXROWCOUNT) * 128;
// With the constant 1GB from above that's the actual value.
- return nElemMax < nArbitraryLimit ? nElemMax : nArbitraryLimit;
+ return std::min(nElemMax, nArbitraryLimit);
}
ScMatrixImpl::ScMatrixImpl(SCSIZE nC, SCSIZE nR) :