summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-01-08 17:01:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-01-11 07:35:43 +0100
commitf14b9d30293f180500fc56d81e5390021758e7c1 (patch)
treea6cd0b853169203cfa0953230e6774e7b1dd81b4 /sc
parentd11120b95ee27cb4b05db466ed07f7a996dda125 (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 'sc')
-rw-r--r--sc/source/core/tool/interpr1.cxx6
-rw-r--r--sc/source/core/tool/reftokenhelper.cxx2
-rw-r--r--sc/source/ui/vba/vbarange.cxx4
-rw-r--r--sc/source/ui/view/printfun.cxx6
-rw-r--r--sc/source/ui/view/tabview2.cxx4
5 files changed, 11 insertions, 11 deletions
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index f51cc1b1b55d..46a3d7df4dd4 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -511,8 +511,8 @@ static void lcl_AdjustJumpMatrix( ScJumpMatrix* pJumpM, SCSIZE nParmCols, SCSIZE
{
if ( nJumpCols == 1 && nJumpRows == 1 )
{
- nAdjustCols = nParmCols > nResCols ? nParmCols : nResCols;
- nAdjustRows = nParmRows > nResRows ? nParmRows : nResRows;
+ nAdjustCols = std::max(nParmCols, nResCols);
+ nAdjustRows = std::max(nParmRows, nResRows);
}
else if ( nJumpCols == 1 )
{
@@ -8772,7 +8772,7 @@ void ScInterpreter::ScMidB()
aStr = lcl_LeftB(aStr, (sal_Int32)fAnfang + (sal_Int32)fCnt - 1);
sal_Int32 nCnt = getLengthB(aStr) - (sal_Int32)fAnfang + 1;
- aStr = lcl_RightB(aStr, nCnt>0 ? nCnt:0);
+ aStr = lcl_RightB(aStr, std::max<sal_Int32>(nCnt,0));
PushString(aStr);
}
}
diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx
index f47f6846a2f6..1d792f7222c8 100644
--- a/sc/source/core/tool/reftokenhelper.cxx
+++ b/sc/source/core/tool/reftokenhelper.cxx
@@ -301,7 +301,7 @@ private:
return false;
T nMin = nMin1 < nMin2 ? nMin1 : nMin2;
- T nMax = nMax1 > nMax2 ? nMax1 : nMax2;
+ T nMax = std::max(nMax1, nMax2);
rNewMin = nMin;
rNewMax = nMax;
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 7cfc4109e5e3..added596c776 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -2726,8 +2726,8 @@ ScVbaRange::Range( const uno::Any &Cell1, const uno::Any &Cell2, bool bForceUseI
resultAddress.StartColumn = ( cell1.StartColumn < cell2.StartColumn ) ? cell1.StartColumn : cell2.StartColumn;
resultAddress.StartRow = ( cell1.StartRow < cell2.StartRow ) ? cell1.StartRow : cell2.StartRow;
- resultAddress.EndColumn = ( cell1.EndColumn > cell2.EndColumn ) ? cell1.EndColumn : cell2.EndColumn;
- resultAddress.EndRow = ( cell1.EndRow > cell2.EndRow ) ? cell1.EndRow : cell2.EndRow;
+ resultAddress.EndColumn = std::max( cell1.EndColumn, cell2.EndColumn );
+ resultAddress.EndRow = std::max( cell1.EndRow, cell2.EndRow );
if ( bForceUseInpuRangeTab )
{
// this is a call from Application.Range( x,y )
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index a009dca5b88e..5a7711e9867a 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -2810,7 +2810,7 @@ void ScPrintFunc::CalcZoom( sal_uInt16 nRangeNo ) // calcu
// #i54993# use min forced by breaks if it's > # pages in
// scale parameter to avoid bottoming out at <= ZOOM_MIN
- nPagesToFit = nMinPages > nPagesToFit ? nMinPages : nPagesToFit;
+ nPagesToFit = std::max(nMinPages, nPagesToFit);
}
sal_uInt16 nLastFitZoom = 0, nLastNonFitZoom = 0;
@@ -2868,8 +2868,8 @@ void ScPrintFunc::CalcZoom( sal_uInt16 nRangeNo ) // calcu
// #i54993# use min forced by breaks if it's > # pages in
// scale parameters to avoid bottoming out at <= ZOOM_MIN
- nW = nMinPagesW > nW ? nMinPagesW : nW;
- nH = nMinPagesH > nH ? nMinPagesH : nH;
+ nW = std::max(nMinPagesW, nW);
+ nH = std::max(nMinPagesH, nH);
}
sal_uInt16 nLastFitZoom = 0, nLastNonFitZoom = 0;
diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index d7efffce5c70..ee2897e38a69 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -550,12 +550,12 @@ void ScTabView::MarkCursor( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
if ( nBlockStartX <= nCurX + nColSpan - 1 )
{
SCCOL nCurXOffsetTemp = (nCurX < nCurX + nColSpan - 1) ? nColSpan - 1 : 0;
- nCurXOffset = nCurXOffset > nCurXOffsetTemp ? nCurXOffset : nCurXOffsetTemp;
+ nCurXOffset = std::max(nCurXOffset, nCurXOffsetTemp);
}
if ( nBlockStartY <= nCurY + nRowSpan - 1 )
{
SCROW nCurYOffsetTemp = (nCurY < nCurY + nRowSpan - 1) ? nRowSpan - 1 : 0;
- nCurYOffset = nCurYOffset > nCurYOffsetTemp ? nCurYOffset : nCurYOffsetTemp;
+ nCurYOffset = std::max(nCurYOffset, nCurYOffsetTemp);
}
if ( !( nBlockStartX <= nCurX && nBlockStartY <= nCurY ) &&
!( nBlockStartX > nCurX + nColSpan - 1 && nBlockStartY > nCurY + nRowSpan - 1 ) )