tdf#161853 vcl: Use const ref instead of pointer
Pass a const reference instead of a pointer
to `SvxIconChoiceCtrl_Impl::IsOver` and dereference
in caller instead of (unconditionally) in the
method itself.
Change-Id: Ib530c33ccaffd794116f0acc042c96e4c29dee1f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169795
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
diff --git a/vcl/source/control/imivctl.hxx b/vcl/source/control/imivctl.hxx
index 95435c7..569e8e4 100644
--- a/vcl/source/control/imivctl.hxx
+++ b/vcl/source/control/imivctl.hxx
@@ -358,7 +358,7 @@ public:
const Size& GetItemSize( IcnViewFieldType ) const;
static bool IsOver(
std::vector<tools::Rectangle>* pSelectedRectList,
const std::vector<tools::Rectangle>& rRects,
const tools::Rectangle& rEntryBoundRect
);
diff --git a/vcl/source/control/imivctl1.cxx b/vcl/source/control/imivctl1.cxx
index bb4d9a4..58236ff 100644
--- a/vcl/source/control/imivctl1.cxx
+++ b/vcl/source/control/imivctl1.cxx
@@ -2264,7 +2264,7 @@ void SvxIconChoiceCtrl_Impl::SelectRect( const tools::Rectangle& rRect, bool bAd
bool bOverlaps;
if( bCalcOverlap )
bOverlaps = IsOver( pOtherRects, aBoundRect );
bOverlaps = IsOver(*pOtherRects, aBoundRect);
else
bOverlaps = false;
bool bOver = aRect.Overlaps( aBoundRect );
@@ -2370,12 +2370,12 @@ void SvxIconChoiceCtrl_Impl::SelectRange(
}
}
bool SvxIconChoiceCtrl_Impl::IsOver( std::vector<tools::Rectangle>* pRectList, const tools::Rectangle& rBoundRect )
bool SvxIconChoiceCtrl_Impl::IsOver(const std::vector<tools::Rectangle>& rRects, const tools::Rectangle& rBoundRect)
{
const sal_uInt16 nCount = pRectList->size();
const sal_uInt16 nCount = rRects.size();
for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ )
{
tools::Rectangle& rRect = (*pRectList)[ nCur ];
const tools::Rectangle& rRect = rRects[ nCur ];
if( rBoundRect.Overlaps( rRect ))
return true;
}