summaryrefslogtreecommitdiff
path: root/vcl
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 /vcl
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 'vcl')
-rw-r--r--vcl/source/control/button.cxx4
-rw-r--r--vcl/source/control/imp_listbox.cxx2
-rw-r--r--vcl/source/fontsubset/sft.cxx4
-rw-r--r--vcl/source/gdi/print3.cxx4
-rw-r--r--vcl/source/window/toolbox.cxx4
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx2
-rw-r--r--vcl/unx/gtk/salnativewidgets-gtk.cxx2
-rw-r--r--vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx2
8 files changed, 12 insertions, 12 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 1f1699397770..bd03840e34bb 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -358,8 +358,8 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
}
}
- aMax.Width() = aTSSize.Width() > aImageSize.Width() ? aTSSize.Width() : aImageSize.Width();
- aMax.Height() = aTSSize.Height() > aImageSize.Height() ? aTSSize.Height() : aImageSize.Height();
+ aMax.Width() = std::max(aTSSize.Width(), aImageSize.Width());
+ aMax.Height() = std::max(aTSSize.Height(), aImageSize.Height());
// Now calculate the output area for the image and the text according to the image align flags
diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx
index 9470e9a68675..755d12cb22bb 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -290,7 +290,7 @@ long ImplEntryList::GetAddedHeight( sal_Int32 i_nEndIndex, sal_Int32 i_nBeginInd
{
long nHeight = 0;
sal_Int32 nStart = i_nEndIndex > i_nBeginIndex ? i_nBeginIndex : i_nEndIndex;
- sal_Int32 nStop = i_nEndIndex > i_nBeginIndex ? i_nEndIndex : i_nBeginIndex;
+ sal_Int32 nStop = std::max(i_nEndIndex, i_nBeginIndex);
sal_Int32 nEntryCount = GetEntryCount();
if( 0 <= nStop && nStop != LISTBOX_ENTRY_NOTFOUND && nEntryCount != 0 )
{
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 098d54b41b2d..98cf6998bef0 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -595,14 +595,14 @@ static int GetCompoundTTOutline(TrueTypeFont *ttf, sal_uInt32 glyphID, ControlPo
abs1 = (a < 0) ? -a : a;
abs2 = (b < 0) ? -b : b;
- m = (abs1 > abs2) ? abs1 : abs2;
+ m = std::max(abs1, abs2);
abs3 = abs1 - abs2;
if (abs3 < 0) abs3 = -abs3;
if (abs3 <= 33) m *= 2;
abs1 = (c < 0) ? -c : c;
abs2 = (d < 0) ? -d : d;
- n = (abs1 > abs2) ? abs1 : abs2;
+ n = std::max(abs1, abs2);
abs3 = abs1 - abs2;
if (abs3 < 0) abs3 = -abs3;
if (abs3 <= 33) n *= 2;
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 4aef505fc7c1..30cdc4aebaa9 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -414,8 +414,8 @@ bool Printer::PreparePrintJob(std::shared_ptr<PrinterController> xController,
if( nRows > 1 || nCols > 1 )
{
PrinterController::MultiPageSetup aMPS;
- aMPS.nRows = nRows > 1 ? nRows : 1;
- aMPS.nColumns = nCols > 1 ? nCols : 1;
+ aMPS.nRows = std::max<sal_Int32>(nRows, 1);
+ aMPS.nColumns = std::max<sal_Int32>(nCols, 1);
sal_Int32 nValue = xController->getIntProperty("NUpPageMarginLeft", aMPS.nLeftMargin);
if( nValue >= 0 )
aMPS.nLeftMargin = nValue;
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 0eb843cf167c..d473684fd0bb 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -973,7 +973,7 @@ void ToolBox::ImplLineSizing( const Point& rPos, tools::Rectangle& rRect, sal_uI
}
Size aWinSize = GetSizePixel();
- ImplToolItems::size_type nMaxLines = (mnLines > mnCurLines) ? mnLines : mnCurLines;
+ ImplToolItems::size_type nMaxLines = std::max(mnLines, mnCurLines);
if ( nMaxLines > TB_MAXLINES )
nMaxLines = TB_MAXLINES;
if ( bHorz )
@@ -1881,7 +1881,7 @@ Size ToolBox::ImplGetOptimalFloatingSize()
// try to preserve current width
- long nLineHeight = ( mnWinHeight > mnMaxItemHeight ) ? mnWinHeight : mnMaxItemHeight;
+ long nLineHeight = std::max( mnWinHeight, mnMaxItemHeight );
int nBorderX = 2*TB_BORDER_OFFSET1 + mnLeftBorder + mnRightBorder;
int nBorderY = 2*TB_BORDER_OFFSET2 + mnTopBorder + mnBottomBorder;
Size aSz( aCurrentSize );
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index b81359c8fea5..fc62e0590988 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -1979,7 +1979,7 @@ int PPDContext::getRenderResolution() const
else
m_pParser->getDefaultResolution( nDPIx, nDPIy );
- nDPI = (nDPIx > nDPIy) ? nDPIx : nDPIy;
+ nDPI = std::max(nDPIx, nDPIy);
}
return nDPI;
}
diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index 313af6cc0518..640bfe5eab6b 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -1237,7 +1237,7 @@ bool GtkSalGraphics::getNativeControlRegion( ControlType nType,
GtkRequisition aReq;
gtk_widget_size_request( widget, &aReq );
tools::Rectangle aEditRect = rControlRegion;
- long nHeight = (aEditRect.GetHeight() > aReq.height) ? aEditRect.GetHeight() : aReq.height;
+ long nHeight = std::max<long>(aEditRect.GetHeight(), aReq.height);
aEditRect = tools::Rectangle( aEditRect.TopLeft(),
Size( aEditRect.GetWidth(), nHeight ) );
rNativeBoundingRegion = aEditRect;
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 38b724be27d8..d605eaf241cd 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -2574,7 +2574,7 @@ tools::Rectangle GetWidgetSize(const tools::Rectangle& rControlRegion, GtkWidget
{
GtkRequisition aReq;
gtk_widget_get_preferred_size(widget, nullptr, &aReq);
- long nHeight = (rControlRegion.GetHeight() > aReq.height) ? rControlRegion.GetHeight() : aReq.height;
+ long nHeight = std::max<long>(rControlRegion.GetHeight(), aReq.height);
return tools::Rectangle(rControlRegion.TopLeft(), Size(rControlRegion.GetWidth(), nHeight));
}