[Libreoffice-commits] core.git: avmedia/source basctl/source chart2/source connectivity/source cui/source dbaccess/source drawinglayer/source editeng/source embeddedobj/source filter/source i18npool/source include/basegfx sal/osl sal/rtl scaddins/source sc/source sd/source sfx2/source starmath/source svtools/source svx/source sw/source vcl/source vcl/unx writerfilter/source xmlhelp/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Jan 11 06:36:17 UTC 2018


 avmedia/source/vlc/vlcframegrabber.cxx                 |    2 +-
 basctl/source/basicide/baside2.cxx                     |    2 +-
 chart2/source/controller/dialogs/DataBrowser.cxx       |    2 +-
 chart2/source/view/charttypes/GL3DBarChart.cxx         |    2 +-
 chart2/source/view/charttypes/Splines.cxx              |    4 ++--
 connectivity/source/drivers/calc/CTable.cxx            |    4 ++--
 cui/source/customize/SvxToolbarConfigPage.cxx          |    2 +-
 dbaccess/source/ui/dlg/indexfieldscontrol.cxx          |    6 +++---
 drawinglayer/source/primitive2d/textlayoutdevice.cxx   |    2 +-
 drawinglayer/source/processor3d/defaultprocessor3d.cxx |    2 +-
 editeng/source/items/borderline.cxx                    |    2 +-
 editeng/source/uno/unoedhlp.cxx                        |    2 +-
 editeng/source/uno/unotext2.cxx                        |    4 ++--
 embeddedobj/source/commonembedding/embedobj.cxx        |    4 ++--
 filter/source/msfilter/svdfppt.cxx                     |    2 +-
 i18npool/source/breakiterator/xdictionary.cxx          |    2 +-
 i18npool/source/search/levdis.cxx                      |    9 +++------
 i18npool/source/textconversion/textconversionImpl.cxx  |    6 +++---
 include/basegfx/color/bcolor.hxx                       |    4 ++--
 include/basegfx/numeric/ftools.hxx                     |    3 ++-
 sal/osl/w32/file_url.cxx                               |    2 +-
 sal/rtl/math.cxx                                       |    2 +-
 sc/source/core/tool/interpr1.cxx                       |    6 +++---
 sc/source/core/tool/reftokenhelper.cxx                 |    2 +-
 sc/source/ui/vba/vbarange.cxx                          |    4 ++--
 sc/source/ui/view/printfun.cxx                         |    6 +++---
 sc/source/ui/view/tabview2.cxx                         |    4 ++--
 scaddins/source/analysis/analysishelper.cxx            |    2 +-
 sd/source/ui/slidesorter/view/SlsLayouter.cxx          |    4 ++--
 sfx2/source/appl/shutdowniconw32.cxx                   |    2 +-
 starmath/source/edit.cxx                               |    2 +-
 starmath/source/visitors.cxx                           |    2 +-
 svtools/source/control/toolbarmenu.cxx                 |    2 +-
 svx/source/svdraw/svdocirc.cxx                         |    4 ++--
 svx/source/svdraw/svdomeas.cxx                         |    2 +-
 sw/source/core/layout/paintfrm.cxx                     |    2 +-
 sw/source/core/layout/tabfrm.cxx                       |    2 +-
 sw/source/core/layout/wsfrm.cxx                        |    2 +-
 sw/source/core/text/porfld.cxx                         |    2 +-
 sw/source/core/text/wrong.cxx                          |    2 +-
 sw/source/filter/html/htmlcss1.cxx                     |    4 ++--
 sw/source/filter/html/htmldrawreader.cxx               |    2 +-
 sw/source/filter/html/htmlplug.cxx                     |    4 ++--
 sw/source/filter/writer/wrtswtbl.cxx                   |    2 +-
 sw/source/filter/ww8/ww8par.cxx                        |    2 +-
 sw/source/uibase/app/applab.cxx                        |    4 ++--
 sw/source/uibase/ribbar/inputwin.cxx                   |    2 +-
 sw/source/uibase/uiview/viewtab.cxx                    |   12 ++++++------
 sw/source/uibase/uno/unotxdoc.cxx                      |    4 ++--
 vcl/source/control/button.cxx                          |    4 ++--
 vcl/source/control/imp_listbox.cxx                     |    2 +-
 vcl/source/fontsubset/sft.cxx                          |    4 ++--
 vcl/source/gdi/print3.cxx                              |    4 ++--
 vcl/source/window/toolbox.cxx                          |    4 ++--
 vcl/unx/generic/printer/ppdparser.cxx                  |    2 +-
 vcl/unx/gtk/salnativewidgets-gtk.cxx                   |    2 +-
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx              |    2 +-
 writerfilter/source/dmapper/PropertyMap.cxx            |    4 ++--
 xmlhelp/source/cxxhelp/provider/urlparameter.cxx       |    4 ++--
 59 files changed, 94 insertions(+), 96 deletions(-)

New commits:
commit f14b9d30293f180500fc56d81e5390021758e7c1
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jan 8 17:01:49 2018 +0200

    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 at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/avmedia/source/vlc/vlcframegrabber.cxx b/avmedia/source/vlc/vlcframegrabber.cxx
index 50c60ce12a31..51cf22e5c8dc 100644
--- a/avmedia/source/vlc/vlcframegrabber.cxx
+++ b/avmedia/source/vlc/vlcframegrabber.cxx
@@ -81,7 +81,7 @@ VLCFrameGrabber::VLCFrameGrabber( wrapper::EventHandler& eh, const rtl::OUString
             return ::uno::Reference< css::graphic::XGraphic >();
         }
 
-        mPlayer.setTime( ( fMediaTime > 0 ? fMediaTime : 0 ) * MSEC_IN_SEC );
+        mPlayer.setTime( std::max(fMediaTime, 0) * MSEC_IN_SEC );
         mPlayer.pause();
 
         condition.wait(std::chrono::seconds(2));
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
index 1c438a908e19..ad26c8d3518e 100644
--- a/basctl/source/basicide/baside2.cxx
+++ b/basctl/source/basicide/baside2.cxx
@@ -817,7 +817,7 @@ sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage )
     sal_Int32 nLinespPage = aPaperSz.Height()/nLineHeight;
     long nXTextWidth = pPrinter->approximate_char_width();
 
-    sal_Int32 nCharspLine = aPaperSz.Width() / (nXTextWidth > 1 ? nXTextWidth : 1);
+    sal_Int32 nCharspLine = aPaperSz.Width() / std::max<long>(nXTextWidth, 1);
     const sal_uInt32 nParas = GetEditEngine()->GetParagraphCount();
 
     sal_Int32 nPages = nParas/nLinespPage+1;
diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx
index 31372feab01a..6a615ad7b409 100644
--- a/chart2/source/controller/dialogs/DataBrowser.cxx
+++ b/chart2/source/controller/dialogs/DataBrowser.cxx
@@ -297,7 +297,7 @@ void SeriesHeader::SetSeriesName( const OUString & rName )
 void SeriesHeader::SetRange( sal_Int32 nStartCol, sal_Int32 nEndCol )
 {
     m_nStartCol = nStartCol;
-    m_nEndCol = (nEndCol > nStartCol) ? nEndCol : nStartCol;
+    m_nEndCol = std::max(nEndCol, nStartCol);
     m_spSeriesName->setStartColumn( nStartCol );
 }
 
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index a7a3f2feae20..e3e8db81d140 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -1479,7 +1479,7 @@ void GL3DBarChart::processAutoFly(sal_uInt32 nId, sal_uInt32 nColor)
         maRenderEvent = EVENT_AUTO_FLY;
         mnSelectBarId = nColorRate > mnColorRate ? nId : mnSelectBarId;
         mnPreSelectBarId = mnSelectBarId;
-        mnColorRate = nColorRate > mnColorRate ? nColorRate : mnColorRate;
+        mnColorRate = std::max(nColorRate, mnColorRate);
     }
 }
 
diff --git a/chart2/source/view/charttypes/Splines.cxx b/chart2/source/view/charttypes/Splines.cxx
index fa31a609c61e..4ff16718f242 100644
--- a/chart2/source/view/charttypes/Splines.cxx
+++ b/chart2/source/view/charttypes/Splines.cxx
@@ -420,7 +420,7 @@ bool createParameterT(const tPointVecType& rUniquePoints, double* t)
         dx = rUniquePoints[i].first - rUniquePoints[i-1].first;
         dy = rUniquePoints[i].second - rUniquePoints[i-1].second;
         // scaling to avoid underflow or overflow
-        fDiffMax = (fabs(dx)>fabs(dy)) ? fabs(dx) : fabs(dy);
+        fDiffMax = std::max(fabs(dx), fabs(dy));
         if (fDiffMax == 0.0)
         {
             bIsSuccessful = false;
@@ -446,7 +446,7 @@ bool createParameterT(const tPointVecType& rUniquePoints, double* t)
             {
                 dx = rUniquePoints[i].first - rUniquePoints[i-1].first;
                 dy = rUniquePoints[i].second - rUniquePoints[i-1].second;
-                fDiffMax = (fabs(dx)>fabs(dy)) ? fabs(dx) : fabs(dy);
+                fDiffMax = std::max(fabs(dx), fabs(dy));
                 // same as above, so should not be zero
                 dx /= fDiffMax;
                 dy /= fDiffMax;
diff --git a/connectivity/source/drivers/calc/CTable.cxx b/connectivity/source/drivers/calc/CTable.cxx
index 47bee0acb54c..16304fa224b2 100644
--- a/connectivity/source/drivers/calc/CTable.cxx
+++ b/connectivity/source/drivers/calc/CTable.cxx
@@ -83,8 +83,8 @@ static void lcl_UpdateArea( const Reference<XCellRange>& xUsedRange, sal_Int32&
         const CellRangeAddress* pData = aAddresses.getConstArray();
         for ( sal_Int32 i=0; i<nCount; i++ )
         {
-            rEndCol = pData[i].EndColumn > rEndCol ? pData[i].EndColumn : rEndCol;
-            rEndRow = pData[i].EndRow    > rEndRow ? pData[i].EndRow    : rEndRow;
+            rEndCol = std::max(pData[i].EndColumn, rEndCol);
+            rEndRow = std::max(pData[i].EndRow, rEndRow);
         }
     }
 }
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx
index 4ee96a3ef0af..eeb2912ba56a 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -875,7 +875,7 @@ Image SvxToolbarEntriesListBox::GetSizedImage(
     // We need 2 pixels to have a bigger border to the next button image
     sal_uInt16  nPosX = std::max( (sal_uInt16) (((( aNewSize.Width() - 2 ) - aImage.GetSizePixel().Width() ) / 2 ) - 1), (sal_uInt16) 0 );
     sal_uInt16  nPosY = std::max( (sal_uInt16) (((( aNewSize.Height() - 2 ) - aImage.GetSizePixel().Height() ) / 2 ) + 1), (sal_uInt16) 0 );
-    Point   aPos( nPosX > 0 ? nPosX : 0, nPosY > 0 ? nPosY : 0 );
+    Point   aPos( std::max<sal_uInt16>(nPosX, 0), std::max<sal_uInt16>(nPosY, 0) );
     rVDev.SetFillColor( aFillColor );
     rVDev.SetLineColor( aFillColor );
     rVDev.DrawRect( ::tools::Rectangle( Point(), aNewSize ));
diff --git a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
index 3907e0f085b3..a717e0b069cc 100644
--- a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
+++ b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx
@@ -185,7 +185,7 @@ namespace dbaui
             sal_Int32 nWidthAsc = GetTextWidth(m_sAscendingText) + GetSettings().GetStyleSettings().GetScrollBarSize();
             sal_Int32 nWidthDesc = GetTextWidth(m_sDescendingText) + GetSettings().GetStyleSettings().GetScrollBarSize();
             // maximum plus some additional space
-            return (nWidthAsc > nWidthDesc ? nWidthAsc : nWidthDesc) + GetTextWidth(OUString('0')) * 2;
+            return std::max(nWidthAsc, nWidthDesc) + GetTextWidth(OUString('0')) * 2;
         }
         return EditBrowseBox::GetTotalCellWidth(_nRow, _nColId);
     }
@@ -211,10 +211,10 @@ namespace dbaui
             sal_Int32 nSortOrderColumnWidth = GetTextWidth(sColumnName);
             // ("ascending" + scrollbar width)
             sal_Int32 nOther = GetTextWidth(m_sAscendingText) + GetSettings().GetStyleSettings().GetScrollBarSize();
-            nSortOrderColumnWidth = nSortOrderColumnWidth > nOther ? nSortOrderColumnWidth : nOther;
+            nSortOrderColumnWidth = std::max(nSortOrderColumnWidth, nOther);
             // ("descending" + scrollbar width)
             nOther = GetTextWidth(m_sDescendingText) + GetSettings().GetStyleSettings().GetScrollBarSize();
-            nSortOrderColumnWidth = nSortOrderColumnWidth > nOther ? nSortOrderColumnWidth : nOther;
+            nSortOrderColumnWidth = std::max(nSortOrderColumnWidth, nOther);
             // (plus some additional space)
             nSortOrderColumnWidth += GetTextWidth(OUString('0')) * 2;
             InsertDataColumn(COLUMN_ID_ORDER, sColumnName, nSortOrderColumnWidth, HeaderBarItemBits::STDSTYLE, 1);
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index ca0b8bb7e95c..820f0f9dbe4c 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -453,7 +453,7 @@ namespace drawinglayer
             // TODO: eKerning
 
             // set FontHeight and init to no FontScaling
-            o_rSize.setY(rFont.GetFontSize().getHeight() > 0 ? rFont.GetFontSize().getHeight() : 0);
+            o_rSize.setY(std::max<long>(rFont.GetFontSize().getHeight(), 0));
             o_rSize.setX(o_rSize.getY());
 
 #ifdef _WIN32
diff --git a/drawinglayer/source/processor3d/defaultprocessor3d.cxx b/drawinglayer/source/processor3d/defaultprocessor3d.cxx
index 40eac4395e04..36b6939362d7 100644
--- a/drawinglayer/source/processor3d/defaultprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/defaultprocessor3d.cxx
@@ -234,7 +234,7 @@ namespace drawinglayer
                 // calculate logic pixel size in texture coordinates
                 const double fLogicTexSizeX(fLogicPixelSizeWorld / rPrimitive.getTextureSize().getX());
                 const double fLogicTexSizeY(fLogicPixelSizeWorld / rPrimitive.getTextureSize().getY());
-                const double fLogicTexSize(fLogicTexSizeX > fLogicTexSizeY ? fLogicTexSizeX : fLogicTexSizeY);
+                const double fLogicTexSize(std::max(fLogicTexSizeX, fLogicTexSizeY));
 
                 // create texture and set
                 mpGeoTexSvx.reset(new texture::GeoTexSvxMultiHatch(rPrimitive, fLogicTexSize));
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx
index 3005e3161827..e62b15d4c73d 100644
--- a/editeng/source/items/borderline.cxx
+++ b/editeng/source/items/borderline.cxx
@@ -192,7 +192,7 @@ ConvertBorderWidthFromWord(SvxBorderLineStyle const eStyle, double const i_fWidt
                 case 2:
                     return (fWidth * 2.0); // thick
                 case 5: // fdo#55526: map 0 hairline width to > 0
-                    return (fWidth > 1.0) ? fWidth : 1.0;
+                    return std::max(fWidth, 1.0);
                 default:
                     return fWidth;
             }
diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx
index 767a7c14b41f..ee34063b5a67 100644
--- a/editeng/source/uno/unoedhlp.cxx
+++ b/editeng/source/uno/unoedhlp.cxx
@@ -144,7 +144,7 @@ bool SvxEditSourceHelper::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nE
             nClosestStartIndex_e = nCurrIndex;
         }
     }
-    sal_Int32 nClosestStartIndex = nClosestStartIndex_s > nClosestStartIndex_e ? nClosestStartIndex_s : nClosestStartIndex_e;
+    sal_Int32 nClosestStartIndex = std::max(nClosestStartIndex_s, nClosestStartIndex_e);
 
     // find closest index behind of nIndex
     sal_Int32 nClosestEndIndex_s, nClosestEndIndex_e;
diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx
index 8e059941c0d2..ddd85b8f743f 100644
--- a/editeng/source/uno/unotext2.cxx
+++ b/editeng/source/uno/unotext2.cxx
@@ -56,7 +56,7 @@ SvxUnoTextContentEnumeration::SvxUnoTextContentEnumeration( const SvxUnoTextBase
             sal_Int32 nStartPos = 0;
             sal_Int32 nEndPos = mrText.GetEditSource()->GetTextForwarder()->GetTextLen( currentPara );
             if( currentPara == maSelection.nStartPara )
-                nStartPos = nStartPos>maSelection.nStartPos ? nStartPos : maSelection.nStartPos;
+                nStartPos = std::max(nStartPos, maSelection.nStartPos);
             if( currentPara == maSelection.nEndPara )
                 nEndPos = nEndPos<maSelection.nEndPos ? nEndPos : maSelection.nEndPos;
             ESelection aCurrentParaSel = ESelection( currentPara, nStartPos, currentPara, nEndPos );
@@ -399,7 +399,7 @@ SvxUnoTextRangeEnumeration::SvxUnoTextRangeEnumeration(const SvxUnoTextBase& rTe
             if( nEndPos < mnSel.nStartPos )
                 continue;
 
-            nStartPos = nStartPos>mnSel.nStartPos ? nStartPos : mnSel.nStartPos;
+            nStartPos = std::max<int>(nStartPos, mnSel.nStartPos);
             nEndPos = nEndPos<mnSel.nEndPos ? nEndPos : mnSel.nEndPos;
             ESelection aSel( mnParagraph, nStartPos, mnParagraph, nEndPos );
 
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx
index 60020a4ab86f..32c5085232dc 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -58,8 +58,8 @@ awt::Rectangle GetRectangleInterception( const awt::Rectangle& aRect1, const awt
     OSL_ENSURE( aRect1.Width >= 0 && aRect2.Width >= 0 && aRect1.Height >= 0 && aRect2.Height >= 0,
                 "Offset must not be less then zero!" );
 
-    aResult.X = aRect1.X > aRect2.X ? aRect1.X : aRect2.X;
-    aResult.Y = aRect1.Y > aRect2.Y ? aRect1.Y : aRect2.Y;
+    aResult.X = std::max(aRect1.X, aRect2.X);
+    aResult.Y = std::max(aRect1.Y, aRect2.Y);
 
     sal_Int32 nRight1 = aRect1.X + aRect1.Width;
     sal_Int32 nBottom1 = aRect1.Y + aRect1.Height;
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 32674f5ccf5e..ad52f219c4c3 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -6360,7 +6360,7 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet,  boost::optional< sal_Int16 >&
             aTabItem.Insert( SvxTabStop( (sal_uInt16)0 ) );
         if ( nDefaultTab )
         {
-            nTab = ( nTextOfs2 > nLatestManTab ) ? nTextOfs2 : nLatestManTab;
+            nTab = std::max( nTextOfs2, nLatestManTab );
             nTab /= nDefaultTab;
             nTab = nDefaultTab * ( 1 + nTab );
             for ( i = 0; ( i < 20 ) && ( nTab < 0x1b00 ); i++ )
diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx
index 6ee5256328df..2619b350a189 100644
--- a/i18npool/source/breakiterator/xdictionary.cxx
+++ b/i18npool/source/breakiterator/xdictionary.cxx
@@ -350,7 +350,7 @@ WordBreakCache& xdictionary::getCache(const sal_Unicode *text, Boundary const &
             rCache.size = len;
         }
         else
-            rCache.size = len > DEFAULT_SIZE ? len : DEFAULT_SIZE;
+            rCache.size = std::max<sal_Int32>(len, DEFAULT_SIZE);
         rCache.contents = new sal_Unicode[rCache.size + 1];
         rCache.wordboundary = new sal_Int32[rCache.size + 2];
     }
diff --git a/i18npool/source/search/levdis.cxx b/i18npool/source/search/levdis.cxx
index 60970fe402d9..6d8330af3852 100644
--- a/i18npool/source/search/levdis.cxx
+++ b/i18npool/source/search/levdis.cxx
@@ -56,6 +56,7 @@
 */
 
 #include <string.h>
+#include <algorithm>
 
 #if defined( _MSC_VER )
 #pragma warning(once: 4068)
@@ -63,10 +64,6 @@
 
 #include "levdis.hxx"
 
-#ifdef __sun
-#undef min
-#endif
-
 #define LEVDISBIG   (nLimit + 1)    // Return value if distance > nLimit
 #define LEVDISDOUBLEBUF 2048        // no doubling atop this border
 
@@ -340,9 +337,9 @@ int WLevDistance::Mid3( int x, int y, int z )
 int WLevDistance::Max3( int x, int y, int z )
 {
     if ( x > y )
-        return( x > z ? x : z );
+        return std::max(x, z);
     else
-        return( y > z ? y : z );
+        return std::max(y, z);
 }
 
 // initialize data from CTOR
diff --git a/i18npool/source/textconversion/textconversionImpl.cxx b/i18npool/source/textconversion/textconversionImpl.cxx
index ea81ff3f19c7..990e59f112b4 100644
--- a/i18npool/source/textconversion/textconversionImpl.cxx
+++ b/i18npool/source/textconversion/textconversionImpl.cxx
@@ -37,7 +37,7 @@ TextConversionImpl::getConversions( const OUString& aText, sal_Int32 nStartPos,
 
     sal_Int32 len = aText.getLength() - nStartPos;
     if (nLength > len)
-        nLength = len > 0 ? len : 0;
+        nLength = std::max<sal_Int32>(len, 0);
     return xTC->getConversions(aText, nStartPos, nLength, rLocale, nConversionType, nConversionOptions);
 }
 
@@ -49,7 +49,7 @@ TextConversionImpl::getConversion( const OUString& aText, sal_Int32 nStartPos, s
 
     sal_Int32 len = aText.getLength() - nStartPos;
     if (nLength > len)
-        nLength = len > 0 ? len : 0;
+        nLength = std::max<sal_Int32>(len, 0);
     return xTC->getConversion(aText, nStartPos, nLength, rLocale, nConversionType, nConversionOptions);
 }
 
@@ -61,7 +61,7 @@ TextConversionImpl::getConversionWithOffset( const OUString& aText, sal_Int32 nS
 
     sal_Int32 len = aText.getLength() - nStartPos;
     if (nLength > len)
-        nLength = len > 0 ? len : 0;
+        nLength = std::max<sal_Int32>(len, 0);
     return xTC->getConversionWithOffset(aText, nStartPos, nLength, rLocale, nConversionType, nConversionOptions, offset);
 }
 
diff --git a/include/basegfx/color/bcolor.hxx b/include/basegfx/color/bcolor.hxx
index 300f8db81e81..02f8fb882790 100644
--- a/include/basegfx/color/bcolor.hxx
+++ b/include/basegfx/color/bcolor.hxx
@@ -151,8 +151,8 @@ namespace basegfx
             const double fDistG(getDistanceGreen(rColor));
             const double fDistB(getDistanceBlue(rColor));
 
-            double fRetval(fDistR > fDistG ? fDistR : fDistG);
-            return (fRetval > fDistB ? fRetval : fDistB);
+            double fRetval(std::max(fDistR, fDistG));
+            return std::max(fRetval, fDistB);
         }
 
         // clamp color to [0.0..1.0] values in all three intensity components
diff --git a/include/basegfx/numeric/ftools.hxx b/include/basegfx/numeric/ftools.hxx
index eb030b2530d1..5836b48406ae 100644
--- a/include/basegfx/numeric/ftools.hxx
+++ b/include/basegfx/numeric/ftools.hxx
@@ -23,6 +23,7 @@
 #include <rtl/math.hxx>
 #include <basegfx/basegfxdllapi.h>
 #include <limits>
+#include <algorithm>
 
 // standard PI defines from solar.h, but we do not want to link against tools
 
@@ -101,7 +102,7 @@ namespace basegfx
         if(fVal < 0.0)
             return (fVal < -0.00001 ? fVal : -0.00001);
         else
-            return (fVal > 0.00001 ? fVal : 0.00001);
+            return std::max(fVal, 0.00001);
     }
 
     /** clamp given value against given minimum and maximum values
diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx
index d25fd9b56d71..9a53e143c6a4 100644
--- a/sal/osl/w32/file_url.cxx
+++ b/sal/osl/w32/file_url.cxx
@@ -314,7 +314,7 @@ static sal_Int32 PathRemoveFileSpec(LPWSTR lpPath, LPWSTR lpFileName, sal_Int32
         lpFileName[0] = 0;
         LPWSTR  lpLastBkSlash = wcsrchr( lpPath, '\\' );
         LPWSTR  lpLastSlash = wcsrchr( lpPath, '/' );
-        LPWSTR  lpLastDelimiter = lpLastSlash > lpLastBkSlash ? lpLastSlash : lpLastBkSlash;
+        LPWSTR  lpLastDelimiter = std::max(lpLastSlash, lpLastBkSlash);
 
         if ( lpLastDelimiter )
         {
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index a450f7baa774..f8a0f9dcec47 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -213,7 +213,7 @@ int getBitsInFracPart(double fAbsValue)
     int nFracSignificant = 53 - nLeastSignificant;
     int nBitsInFracPart = nFracSignificant - nExponent;
 
-    return nBitsInFracPart > 0 ? nBitsInFracPart : 0;
+    return std::max(nBitsInFracPart, 0);
 }
 
 template< typename T >
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 ) )
diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
index c66eb30afe9b..ee54dac9172a 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -2732,7 +2732,7 @@ sal_Int32 ScaDate::getDiff( const ScaDate& rFrom, const ScaDate& rTo )
     }
     // finally add remaining days in this month
     nDiff += aTo.nDay - aFrom.nDay;
-    return nDiff > 0 ? nDiff : 0;
+    return std::max<sal_Int32>(nDiff, 0);
 }
 
 bool ScaDate::operator<( const ScaDate& rCmp ) const
diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
index 754bb4db51f3..fc842d5d7419 100644
--- a/sd/source/ui/slidesorter/view/SlsLayouter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
@@ -912,10 +912,10 @@ sal_Int32 Layouter::Implementation::GetIndex (
     return ::tools::Rectangle(
         Point (mnLeftBorder
             + nColumn * maPageObjectSize.Width()
-            + (nColumn>0 ? nColumn : 0) * mnHorizontalGap,
+            + std::max<sal_Int32>(nColumn,0) * mnHorizontalGap,
             mnTopBorder
             + nRow * maPageObjectSize.Height()
-            + (nRow>0 ? nRow : 0) * mnVerticalGap),
+            + std::max<sal_Int32>(nRow,0) * mnVerticalGap),
         maPageObjectSize);
 }
 
diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx
index 04e34a99f75c..b93639ee1c01 100644
--- a/sfx2/source/appl/shutdowniconw32.cxx
+++ b/sfx2/source/appl/shutdowniconw32.cxx
@@ -570,7 +570,7 @@ void OnMeasureItem(HWND hwnd, LPMEASUREITEMSTRUCT lpmis)
             pMyItem->text.getLength(), &size);
 
     lpmis->itemWidth = size.cx + 4 + GetSystemMetrics( SM_CXSMICON );
-    lpmis->itemHeight = (size.cy > GetSystemMetrics( SM_CYSMICON )) ? size.cy : GetSystemMetrics( SM_CYSMICON );
+    lpmis->itemHeight = std::max<int>(size.cy, GetSystemMetrics( SM_CYSMICON ));
     lpmis->itemHeight += 4;
 
     DeleteObject( SelectObject(hdc, hfntOld) );
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index 84094839b961..e6bf5138fd06 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -284,7 +284,7 @@ void SmEditWindow::Resize()
         if (pEditView->GetVisArea().Top() > nMaxVisAreaStart)
         {
             tools::Rectangle aVisArea(pEditView->GetVisArea() );
-            aVisArea.Top() = (nMaxVisAreaStart > 0 ) ? nMaxVisAreaStart : 0;
+            aVisArea.Top() = std::max<long>(nMaxVisAreaStart, 0);
             aVisArea.SetSize(pEditView->GetOutputArea().GetSize());
             pEditView->SetVisArea(aVisArea);
             pEditView->ShowCursor();
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx
index 510b4d0b2e37..a9d090251368 100644
--- a/starmath/source/visitors.cxx
+++ b/starmath/source/visitors.cxx
@@ -675,7 +675,7 @@ void SmSetSelectionVisitor::Visit( SmTextNode* pNode ) {
     pNode->SetSelected(true);
     if( i1 != -1 && i2 != -1 ) {
         start = i1 < i2 ? i1 : i2; //MIN
-        end   = i1 > i2 ? i1 : i2; //MAX
+        end   = std::max(i1, i2);
     } else if( mbSelecting && i1 != -1 ) {
         start = 0;
         end = i1;
diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx
index 12a651f49fa0..92cb4b88e83f 100644
--- a/svtools/source/control/toolbarmenu.cxx
+++ b/svtools/source/control/toolbarmenu.cxx
@@ -544,7 +544,7 @@ static long ImplGetNativeCheckAndRadioSize(vcl::RenderContext const & rRenderCon
             rMaxWidth = std::max (rMaxWidth, aNativeContent.GetWidth());
         }
     }
-    return (rCheckHeight > rRadioHeight) ? rCheckHeight : rRadioHeight;
+    return std::max(rCheckHeight, rRadioHeight);
 }
 
 #define gfxExtra 7
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index 5024e265de67..61b050d39fe2 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -57,7 +57,7 @@ Point GetAnglePnt(const tools::Rectangle& rR, long nAngle)
     Point aCenter(rR.Center());
     long nWdt=rR.Right()-rR.Left();
     long nHgt=rR.Bottom()-rR.Top();
-    long nMaxRad=((nWdt>nHgt ? nWdt : nHgt)+1) /2;
+    long nMaxRad=(std::max(nWdt,nHgt)+1) /2;
     double a;
     a=nAngle*nPi180;
     Point aRetval(svx::Round(cos(a)*nMaxRad),-svx::Round(sin(a)*nMaxRad));
@@ -863,7 +863,7 @@ void SdrCircObj::NbcMirror(const Point& rRef1, const Point& rRef2)
         Point aCenter(maRect.Center());
         long nWdt=maRect.GetWidth()-1;
         long nHgt=maRect.GetHeight()-1;
-        long nMaxRad=((nWdt>nHgt ? nWdt : nHgt)+1) /2;
+        long nMaxRad=(std::max(nWdt,nHgt)+1) /2;
         double a;
         // starting point
         a=nStartAngle*nPi180;
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index c8ea551e235a..ff7980c5a74c 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -336,7 +336,7 @@ void SdrMeasureObj::ImpTakeAttr(ImpMeasureRec& rRec) const
 long impGetLineStartEndDistance(const basegfx::B2DPolyPolygon& rPolyPolygon, long nNewWidth, bool bCenter)
 {
     const basegfx::B2DRange aPolygonRange(rPolyPolygon.getB2DRange());
-    const double fOldWidth(aPolygonRange.getWidth() > 1.0 ? aPolygonRange.getWidth() : 1.0);
+    const double fOldWidth(std::max(aPolygonRange.getWidth(), 1.0));
     const double fScale((double)nNewWidth / fOldWidth);
     long nHeight(basegfx::fround(aPolygonRange.getHeight() * fScale));
 
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";
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));
 }
 
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index e6b58422b9c6..2ecf76bd2793 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -966,8 +966,8 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
     }
 
     //now set the top/bottom margin for the follow page style
-    Insert( PROP_TOP_MARGIN, uno::makeAny( nTopMargin > 0 ? nTopMargin : 0 ) );
-    Insert( PROP_BOTTOM_MARGIN, uno::makeAny( nBottomMargin > 0 ? nBottomMargin : 0 ) );
+    Insert( PROP_TOP_MARGIN, uno::makeAny( std::max<sal_Int32>(nTopMargin, 0) ) );
+    Insert( PROP_BOTTOM_MARGIN, uno::makeAny( std::max<sal_Int32>(nBottomMargin, 0) ) );
 }
 
 uno::Reference< beans::XPropertySet > lcl_GetRangeProperties( bool bIsFirstSection,
diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
index 2d8a984ef957..b43d0d547b95 100644
--- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
+++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
@@ -904,7 +904,7 @@ sal_Int32 SAL_CALL InputStreamTransformer::readBytes( Sequence< sal_Int8 >& aDat
     for( int k = 0; k < curr; ++k )
         aData[k] = buffer[pos++];
 
-    return curr > 0 ? curr : 0;
+    return std::max(curr, 0);
 }
 
 
@@ -924,7 +924,7 @@ void SAL_CALL InputStreamTransformer::skipBytes( sal_Int32 nBytesToSkip )
 sal_Int32 SAL_CALL InputStreamTransformer::available()
 {
     osl::MutexGuard aGuard( m_aMutex );
-    return buffer.getLength() - pos > 0 ? buffer.getLength() - pos : 0 ;
+    return std::max<sal_Int32>(buffer.getLength() - pos, 0);
 }
 
 


More information about the Libreoffice-commits mailing list