summaryrefslogtreecommitdiff
path: root/sw/source
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 /sw/source
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 'sw/source')
-rw-r--r--sw/source/core/layout/paintfrm.cxx2
-rw-r--r--sw/source/core/layout/tabfrm.cxx2
-rw-r--r--sw/source/core/layout/wsfrm.cxx2
-rw-r--r--sw/source/core/text/porfld.cxx2
-rw-r--r--sw/source/core/text/wrong.cxx2
-rw-r--r--sw/source/filter/html/htmlcss1.cxx4
-rw-r--r--sw/source/filter/html/htmldrawreader.cxx2
-rw-r--r--sw/source/filter/html/htmlplug.cxx4
-rw-r--r--sw/source/filter/writer/wrtswtbl.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par.cxx2
-rw-r--r--sw/source/uibase/app/applab.cxx4
-rw-r--r--sw/source/uibase/ribbar/inputwin.cxx2
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx12
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx4
14 files changed, 23 insertions, 23 deletions
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index c4edfba5a5b0..1244316e310c 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -2782,7 +2782,7 @@ void SwTabFramePainter::Insert( SwLineEntry& rNew, bool bHori )
const svx::frame::Style& rOldAttr = rOld.maAttribute;
const svx::frame::Style& rNewAttr = rNew.maAttribute;
- const svx::frame::Style& rCmpAttr = rNewAttr > rOldAttr ? rNewAttr : rOldAttr;
+ const svx::frame::Style& rCmpAttr = std::max(rNewAttr, rOldAttr);
if ( SwLineEntry::OVERLAP1 == nOverlapType )
{
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index 1f3024a77592..65ef231b294e 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3038,7 +3038,7 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
if ( nReal < nDist )
{
- long nTmp = GetUpper()->Grow( nDist - ( nReal > 0 ? nReal : 0), bTst, bInfo );
+ long nTmp = GetUpper()->Grow( nDist - std::max<long>(nReal, 0), bTst, bInfo );
if ( IsRestrictTableGrowth() )
{
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index f36667e96554..04a798c029b0 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -2110,7 +2110,7 @@ SwTwips SwContentFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo )
if( GetUpper() )
{
if( bTst || !GetUpper()->IsFooterFrame() )
- nReal = GetUpper()->Grow( nDist - (nReal > 0 ? nReal : 0),
+ nReal = GetUpper()->Grow( nDist - std::max<long>(nReal, 0),
bTst, bInfo );
else
{
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 777165819b55..bb2148d4d97d 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -828,7 +828,7 @@ bool SwGrfNumPortion::Format( SwTextFormatInfo &rInf )
const bool bFull = rInf.Width() < rInf.X() + Width();
const bool bFly = rInf.GetFly() ||
( rInf.GetLast() && rInf.GetLast()->IsFlyPortion() );
- SetAscent( static_cast<sal_uInt16>(GetRelPos() > 0 ? GetRelPos() : 0) );
+ SetAscent( std::max<sal_uInt16>(GetRelPos(), 0) );
if( GetAscent() > Height() )
Height( GetAscent() );
diff --git a/sw/source/core/text/wrong.cxx b/sw/source/core/text/wrong.cxx
index af72d11df73d..3968bce1c1e5 100644
--- a/sw/source/core/text/wrong.cxx
+++ b/sw/source/core/text/wrong.cxx
@@ -173,7 +173,7 @@ sal_Int32 SwWrongList::NextWrong( sal_Int32 nChk ) const
}
}
if( nRet > GetBeginInv() && nChk < GetEndInv() )
- nRet = nChk > GetBeginInv() ? nChk : GetBeginInv();
+ nRet = std::max(nChk, GetBeginInv());
return nRet;
}
diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx
index 14f7061c6233..e66fd1408d09 100644
--- a/sw/source/filter/html/htmlcss1.cxx
+++ b/sw/source/filter/html/htmlcss1.cxx
@@ -2048,7 +2048,7 @@ void SwHTMLParser::SetVarSize( SvxCSS1PropertyInfo const &rPropInfo,
nWidth = MINFLY;
break;
case SVX_CSS1_LTYPE_TWIP:
- nWidth = rPropInfo.m_nWidth > MINFLY ? rPropInfo.m_nWidth : MINFLY;
+ nWidth = std::max<long>(rPropInfo.m_nWidth, MINFLY);
nPrcWidth = 0;
break;
default:
@@ -2062,7 +2062,7 @@ void SwHTMLParser::SetVarSize( SvxCSS1PropertyInfo const &rPropInfo,
case SVX_CSS1_LTYPE_TWIP:
// Netscape and MS-IE interpreting the height incorrectly as minimum height,
// therefore we are doing the same.
- nHeight = rPropInfo.m_nHeight > MINFLY ? rPropInfo.m_nHeight : MINFLY;
+ nHeight = std::max<long>(rPropInfo.m_nHeight, MINFLY);
break;
default:
;
diff --git a/sw/source/filter/html/htmldrawreader.cxx b/sw/source/filter/html/htmldrawreader.cxx
index b937eea4608d..457475246838 100644
--- a/sw/source/filter/html/htmldrawreader.cxx
+++ b/sw/source/filter/html/htmldrawreader.cxx
@@ -303,7 +303,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable )
else
{
const sal_Int32 nLoop = rOption.GetSNumber();
- nCount = static_cast<sal_uInt16>(nLoop>0 ? nLoop : 0);
+ nCount = std::max<sal_Int32>(nLoop, 0);
}
break;
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 3179bfa68e21..069aeea16efb 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -235,8 +235,8 @@ void SwHTMLParser::SetSpace( const Size& rPixSpace,
if( nLeftSpace > 0 || nRightSpace > 0 )
{
SvxLRSpaceItem aLRItem( RES_LR_SPACE );
- aLRItem.SetLeft( nLeftSpace > 0 ? nLeftSpace : 0 );
- aLRItem.SetRight( nRightSpace > 0 ? nRightSpace : 0 );
+ aLRItem.SetLeft( std::max<sal_Int32>(nLeftSpace, 0) );
+ aLRItem.SetRight( std::max<sal_Int32>(nRightSpace, 0) );
rFlyItemSet.Put( aLRItem );
if( nLeftSpace )
{
diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx
index 12d26d1b7a53..5af4efe89ffb 100644
--- a/sw/source/filter/writer/wrtswtbl.cxx
+++ b/sw/source/filter/writer/wrtswtbl.cxx
@@ -382,7 +382,7 @@ long SwWriteTable::GetAbsHeight(long nRawHeight, size_t const nRow,
}
OSL_ENSURE( nRawHeight > 0, "Row Height <= 0. OK?" );
- return nRawHeight > 0 ? nRawHeight : 0;
+ return std::max<long>(nRawHeight, 0);
}
bool SwWriteTable::ShouldExpandSub(const SwTableBox *pBox, bool /*bExpandedBefore*/,
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index bf508642f9b8..7d16cb4449d2 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1213,7 +1213,7 @@ static long lcl_GetTrueMargin(const SvxLRSpaceItem &rLR, const SwNumFormat &rFor
const long nReverseListIndented = GetListFirstLineIndent(rFormat);
long nExtraListIndent = nPseudoListBodyIndent + nReverseListIndented;
- return nExtraListIndent > 0 ? nExtraListIndent : 0;
+ return std::max<long>(nExtraListIndent, 0);
}
// #i103711#
diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx
index 6f688a5d9903..b731650e00a0 100644
--- a/sw/source/uibase/app/applab.cxx
+++ b/sw/source/uibase/app/applab.cxx
@@ -259,8 +259,8 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel)
// Set page size
long lPgWidth, lPgHeight;
- lPgWidth = (rItem.m_lPWidth > MINLAY ? rItem.m_lPWidth : MINLAY);
- lPgHeight = (rItem.m_lPHeight > MINLAY ? rItem.m_lPHeight : MINLAY);
+ lPgWidth = std::max<sal_Int32>(rItem.m_lPWidth, MINLAY);
+ lPgHeight = std::max<sal_Int32>(rItem.m_lPHeight, MINLAY);
rFormat.SetFormatAttr( SwFormatFrameSize( ATT_FIX_SIZE, lPgWidth, lPgHeight ));
// Numbering type
SvxNumberType aType;
diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx
index 7001bec02ee1..32faf2d109e5 100644
--- a/sw/source/uibase/ribbar/inputwin.cxx
+++ b/sw/source/uibase/ribbar/inputwin.cxx
@@ -111,7 +111,7 @@ SwInputWindow::SwInputWindow(vcl::Window* pParent, SfxDispatcher const * pDispat
Size aSizeTbx = CalcWindowSizePixel();
Size aEditSize = aEdit->GetSizePixel();
tools::Rectangle aItemRect( GetItemRect(FN_FORMULA_CALC) );
- long nMaxHeight = (aEditSize.Height() > aItemRect.GetHeight()) ? aEditSize.Height() : aItemRect.GetHeight();
+ long nMaxHeight = std::max(aEditSize.Height(), aItemRect.GetHeight());
if( nMaxHeight+2 > aSizeTbx.Height() )
aSizeTbx.Height() = nMaxHeight+2;
Size aSize = GetSizePixel();
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index c4e79e9e4199..7a53443d5d2a 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -1703,8 +1703,8 @@ void SwView::StateTabWin(SfxItemSet& rSet)
const int nRgt = (bTableVertical ? nPageHeight : nPageWidth) -
(aTabCols.GetLeftMin() + aTabCols.GetRight());
- const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0);
- const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0);
+ const sal_uInt16 nL = std::max< sal_uInt16 >(nLft, 0);
+ const sal_uInt16 nR = std::max< sal_uInt16 >(nRgt, 0);
SvxColumnItem aColItem(nNum, nL, nR);
@@ -1940,8 +1940,8 @@ void SwView::StateTabWin(SfxItemSet& rSet)
const int nRgt = (bVerticalWriting ? nPageWidth : nPageHeight) -
(aTabCols.GetLeftMin() + aTabCols.GetRight());
- const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0);
- const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0);
+ const sal_uInt16 nL = std::max< sal_uInt16 >(nLft, 0);
+ const sal_uInt16 nR = std::max< sal_uInt16 >(nRgt, 0);
SvxColumnItem aColItem(0, nL, nR);
@@ -2014,8 +2014,8 @@ void SwView::StateTabWin(SfxItemSet& rSet)
const int nLft = aTabCols.GetLeftMin() + aTabCols.GetLeft();
const int nRgt = nPageWidth -(aTabCols.GetLeftMin() + aTabCols.GetRight());
- const sal_uInt16 nL = static_cast< sal_uInt16 >(nLft > 0 ? nLft : 0);
- const sal_uInt16 nR = static_cast< sal_uInt16 >(nRgt > 0 ? nRgt : 0);
+ const sal_uInt16 nL = std::max< sal_uInt16 >(nLft, 0);
+ const sal_uInt16 nR = std::max< sal_uInt16 >(nRgt, 0);
aRectangle.Left() = nL;
if(nNum > 1)
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index c1081276d4f0..d012967bee85 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -2792,10 +2792,10 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer(
// put page print settings attribute into render data
const sal_Int32 nRow = pPagePrintSettings->GetRow();
aRenderer[ nRenderDataIdxStart + 0 ].Name = "NUpRows";
- aRenderer[ nRenderDataIdxStart + 0 ].Value <<= ( nRow > 1 ? nRow : 1 );
+ aRenderer[ nRenderDataIdxStart + 0 ].Value <<= std::max<sal_Int32>( nRow, 1);
const sal_Int32 nCol = pPagePrintSettings->GetCol();
aRenderer[ nRenderDataIdxStart + 1 ].Name = "NUpColumns";
- aRenderer[ nRenderDataIdxStart + 1 ].Value <<= ( nCol > 1 ? nCol : 1 );
+ aRenderer[ nRenderDataIdxStart + 1 ].Value <<= std::max<sal_Int32>( nCol, 1);
aRenderer[ nRenderDataIdxStart + 2 ].Name = "NUpPageMarginLeft";
aRenderer[ nRenderDataIdxStart + 2 ].Value <<= pPagePrintSettings->GetLeftSpace();
aRenderer[ nRenderDataIdxStart + 3 ].Name = "NUpPageMarginRight";