summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--avmedia/source/framework/MediaControlBase.cxx5
-rw-r--r--basegfx/source/polygon/b3dpolypolygontools.cxx8
-rw-r--r--comphelper/source/misc/backupfilehelper.cxx2
-rw-r--r--include/oox/helper/helper.hxx2
-rw-r--r--oox/source/export/chartexport.cxx2
-rw-r--r--sc/source/filter/excel/xltools.cxx2
-rw-r--r--sc/source/ui/Accessibility/AccessibleCsvControl.cxx2
-rw-r--r--sdext/source/presenter/PresenterScrollBar.cxx2
-rw-r--r--starmath/source/view.cxx2
-rw-r--r--svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx2
-rw-r--r--svx/source/table/tablehandles.cxx2
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx2
-rw-r--r--vcl/source/filter/graphicfilter.cxx2
-rw-r--r--vcl/source/outdev/bitmap.cxx2
14 files changed, 18 insertions, 19 deletions
diff --git a/avmedia/source/framework/MediaControlBase.cxx b/avmedia/source/framework/MediaControlBase.cxx
index 7c3450d802e1..60faa27cfc3f 100644
--- a/avmedia/source/framework/MediaControlBase.cxx
+++ b/avmedia/source/framework/MediaControlBase.cxx
@@ -27,7 +27,7 @@
using ::rtl::OUString;
-#define AVMEDIA_DB_RANGE -40
+constexpr sal_Int32 AVMEDIA_DB_RANGE = -40;
#define AVMEDIA_LINEINCREMENT 1.0
#define AVMEDIA_PAGEINCREMENT 10.0
@@ -64,8 +64,7 @@ void MediaControlBase::UpdateVolumeSlider( MediaItem const & aMediaItem )
{
mxVolumeSlider->set_sensitive(true);
const sal_Int32 nVolumeDB = aMediaItem.getVolumeDB();
- mxVolumeSlider->set_value( std::min( std::max( nVolumeDB, static_cast< sal_Int32 >( AVMEDIA_DB_RANGE ) ),
- static_cast< sal_Int32 >( 0 ) ) );
+ mxVolumeSlider->set_value( std::clamp( nVolumeDB, sal_Int32(0), AVMEDIA_DB_RANGE ) );
}
}
diff --git a/basegfx/source/polygon/b3dpolypolygontools.cxx b/basegfx/source/polygon/b3dpolypolygontools.cxx
index 3badd683d248..ad2dd5bb7979 100644
--- a/basegfx/source/polygon/b3dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b3dpolypolygontools.cxx
@@ -221,7 +221,7 @@ namespace basegfx::utils
}
// min/max limitations
- nHorSeg = std::min(nMaxSegments, std::max(nMinSegments, nHorSeg));
+ nHorSeg = std::clamp(nHorSeg, nMinSegments, nMaxSegments);
if(!nVerSeg)
{
@@ -229,7 +229,7 @@ namespace basegfx::utils
}
// min/max limitations
- nVerSeg = std::min(nMaxSegments, std::max(nMinSegments, nVerSeg));
+ nVerSeg = std::clamp(nVerSeg, nMinSegments, nMaxSegments);
// create constants
const double fVerDiffPerStep((fVerStop - fVerStart) / static_cast<double>(nVerSeg));
@@ -320,7 +320,7 @@ namespace basegfx::utils
}
// min/max limitations
- nHorSeg = std::min(nMaxSegments, std::max(nMinSegments, nHorSeg));
+ nHorSeg = std::clamp(nHorSeg, nMinSegments, nMaxSegments);
if(!nVerSeg)
{
@@ -328,7 +328,7 @@ namespace basegfx::utils
}
// min/max limitations
- nVerSeg = std::min(nMaxSegments, std::max(nMinSegments, nVerSeg));
+ nVerSeg = std::clamp(nVerSeg, nMinSegments, nMaxSegments);
// vertical loop
for(sal_uInt32 a(0); a < nVerSeg; a++)
diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx
index dc9e0ab9143d..d07442b8f39c 100644
--- a/comphelper/source/misc/backupfilehelper.cxx
+++ b/comphelper/source/misc/backupfilehelper.cxx
@@ -1558,7 +1558,7 @@ namespace comphelper
const sal_uInt16 nConfigNumCopies(static_cast<sal_uInt16>(sTokenOut.toUInt32()));
// limit to range [1..mnMaxAllowedBackups]
- mnNumBackups = std::min(std::max(nConfigNumCopies, mnNumBackups), mnMaxAllowedBackups);
+ mnNumBackups = std::clamp(mnNumBackups, nConfigNumCopies, mnMaxAllowedBackups);
}
if (mbActive && rtl::Bootstrap::get("SecureUserConfigMode", sTokenOut))
diff --git a/include/oox/helper/helper.hxx b/include/oox/helper/helper.hxx
index 9d6befb90c54..da28c88b9e4b 100644
--- a/include/oox/helper/helper.hxx
+++ b/include/oox/helper/helper.hxx
@@ -108,7 +108,7 @@ const sal_Int8 API_ESCAPEHEIGHT_DEFAULT = 58; ///< Relative character
template< typename ReturnType, typename Type >
inline ReturnType getLimitedValue( Type nValue, Type nMin, Type nMax )
{
- return static_cast< ReturnType >( ::std::min( ::std::max( nValue, nMin ), nMax ) );
+ return static_cast< ReturnType >( ::std::clamp( nValue, nMin, nMax ) );
}
template< typename ReturnType, typename Type >
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 491f79e6090f..5f9a35b41ac5 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -4113,7 +4113,7 @@ void ChartExport::exportMarker(const Reference< XPropertySet >& xPropSet)
nSize = nSize/250.0*7.0 + 1; // just guessed based on some test cases,
//the value is always 1 less than the actual value.
- nSize = std::min<sal_Int32>( 72, std::max<sal_Int32>( 2, nSize ) );
+ nSize = std::clamp( int(nSize), 2, 72 );
pFS->singleElement(FSNS(XML_c, XML_size), XML_val, OString::number(nSize));
pFS->startElement(FSNS(XML_c, XML_spPr));
diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx
index 8654ed5d444d..ca0aeb278e1b 100644
--- a/sc/source/filter/excel/xltools.cxx
+++ b/sc/source/filter/excel/xltools.cxx
@@ -274,7 +274,7 @@ XclBoolError XclTools::ErrorToEnum( double& rfDblValue, bool bErrOrBool, sal_uIn
sal_uInt16 XclTools::GetTwipsFromInch( double fInches )
{
return static_cast< sal_uInt16 >(
- ::std::min( ::std::max( (fInches * EXC_TWIPS_PER_INCH + 0.5), 0.0 ), 65535.0 ) );
+ ::std::clamp( fInches * EXC_TWIPS_PER_INCH + 0.5, 0.0, 65535.0 ) );
}
sal_uInt16 XclTools::GetTwipsFromHmm( sal_Int32 nHmm )
diff --git a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
index b16095de21b4..5842675f5a34 100644
--- a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
@@ -391,7 +391,7 @@ sal_Int32 SAL_CALL ScAccessibleCsvRuler::getIndexAtPoint( const css::awt::Point&
ensureAlive();
ScCsvRuler& rRuler = implGetRuler();
// use object's coordinate system, convert to API position
- return lcl_GetApiPos( ::std::min( ::std::max( rRuler.GetPosFromX( rPoint.X ), static_cast<sal_Int32>(0) ), rRuler.GetPosCount() ) );
+ return lcl_GetApiPos( ::std::clamp( rRuler.GetPosFromX( rPoint.X ), sal_Int32(0), rRuler.GetPosCount() ) );
}
OUString SAL_CALL ScAccessibleCsvRuler::getSelectedText()
diff --git a/sdext/source/presenter/PresenterScrollBar.cxx b/sdext/source/presenter/PresenterScrollBar.cxx
index 6aab45820c42..d811c92cfaa0 100644
--- a/sdext/source/presenter/PresenterScrollBar.cxx
+++ b/sdext/source/presenter/PresenterScrollBar.cxx
@@ -659,7 +659,7 @@ void PresenterVerticalScrollBar::UpdateBorders()
else
{
const double nThumbSize = ::std::min(mnThumbSize,mnTotalSize);
- const double nThumbPosition = ::std::min(::std::max(0.0,mnThumbPosition), mnTotalSize - nThumbSize);
+ const double nThumbPosition = ::std::clamp(mnThumbPosition, 0.0, mnTotalSize - nThumbSize);
maBox[Thumb] = geometry::RealRectangle2D(
0, nThumbPosition / mnTotalSize * nPagerHeight,
aWindowBox.Width,
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 9bf6a3080399..abd832340d99 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -575,7 +575,7 @@ void SmGraphicWindow::Command(const CommandEvent& rCEvt)
void SmGraphicWindow::SetZoom(sal_uInt16 Factor)
{
- nZoom = std::min(std::max(Factor, MINZOOM), MAXZOOM);
+ nZoom = std::clamp(Factor, MINZOOM, MAXZOOM);
Fraction aFraction (nZoom, 100);
SetMapMode( MapMode(MapUnit::Map100thMM, Point(), aFraction, aFraction) );
SetTotalSize();
diff --git a/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx
index aaa0f3d14fe7..76af6c23b68e 100644
--- a/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrframeborderprimitive2d.cxx
@@ -458,7 +458,7 @@ namespace
nBaseIndex = bUpper ? nVisEdgeUp : nVisEdgeDn;
}
- const size_t nSecuredIndex(std::min(nNumCutSets - 1, std::max(nBaseIndex, static_cast< size_t >(0))));
+ const size_t nSecuredIndex(std::clamp(nBaseIndex, size_t(0), size_t(nNumCutSets - 1)));
const CutSet& rCutSet(aCutSets[nSecuredIndex]);
ExtendSet& rExt(rExtendSet[my]);
diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx
index 222624c2b3fa..4322bf2ea6fe 100644
--- a/svx/source/table/tablehandles.cxx
+++ b/svx/source/table/tablehandles.cxx
@@ -86,7 +86,7 @@ PointerStyle TableEdgeHdl::GetPointer() const
sal_Int32 TableEdgeHdl::GetValidDragOffset( const SdrDragStat& rDrag ) const
{
- return std::min( std::max( static_cast<sal_Int32>(mbHorizontal ? rDrag.GetDY() : rDrag.GetDX()), mnMin ), mnMax );
+ return std::clamp( static_cast<sal_Int32>(mbHorizontal ? rDrag.GetDY() : rDrag.GetDX()), mnMin, mnMax );
}
basegfx::B2DPolyPolygon TableEdgeHdl::getSpecialDragPoly(const SdrDragStat& rDrag) const
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index c389b4d027f7..3bd8b721574f 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3049,7 +3049,7 @@ namespace
sal_uInt16 lcl_BoundListLevel(const int nActualLevel)
{
- return static_cast<sal_uInt16>( std::min( std::max(nActualLevel, 0), MAXLEVEL-1 ) );
+ return static_cast<sal_uInt16>( std::clamp( nActualLevel, 0, MAXLEVEL-1 ) );
}
}
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index dd6c556b9a19..6d0252648d77 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -529,7 +529,7 @@ static Graphic ImpGetScaledGraphic( const Graphic& rGraphic, FilterConfigItem& r
MapMode aMap( MapUnit::Map100thInch );
sal_Int32 nDPI = rConfigItem.ReadInt32( "Resolution", 75 );
- Fraction aFrac( 1, std::min( std::max( nDPI, sal_Int32( 75 ) ), sal_Int32( 600 ) ) );
+ Fraction aFrac( 1, std::clamp( nDPI, sal_Int32(75), sal_Int32(600) ) );
aMap.SetScaleX( aFrac );
aMap.SetScaleY( aFrac );
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 7a6615fa4bac..7d3d6485d2e7 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -1361,7 +1361,7 @@ void OutputDevice::DrawTransformedBitmapEx(
const Size& rOriginalSizePixel(rBitmapEx.GetSizePixel());
const double fOrigArea(rOriginalSizePixel.Width() * rOriginalSizePixel.Height() * 0.5);
const double fOrigAreaScaled(fOrigArea * 1.44);
- double fMaximumArea(std::min(4500000.0, std::max(1000000.0, fOrigAreaScaled)));
+ double fMaximumArea(std::clamp(fOrigAreaScaled, 1000000.0, 4500000.0));
// tdf#130768 CAUTION(!) using GetViewTransformation() is *not* enough here, it may
// be that mnOutOffX/mnOutOffY is used - see AOO bug 75163, mentioned at
// ImplGetDeviceTransformation declaration