summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-12-07 14:37:56 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-07 17:46:23 +0100
commit5de20e45e48f7654d288f26f768fabddad133bfd (patch)
treecce410ce740ae0ca760855a2ddc2ca09d623e633 /svx
parent7e8e57a456f2b946631eecefd163cb4ff3a3d603 (diff)
improve loplugin:cow_wrapper
to find my previous attempt at this, which only obscured the problem <noelgrandin> I'm such an idiot <noelgrandin> I changed a whole bunch of code to avoid calling const methods on a non-const object <noelgrandin> from p->foo() to std::as_const(*p).foo() <noelgrandin> can you spot the mistake? <bubli> Is this a job interview question? :D <vmiklos> noelgrandin: you did the opposite, now you always call const member functions, while you wanted to always call non-const member functions? <noelgrandin> more like a "why didn't the smart people on this channel tell me I was an idiot" :-) <noelgrandin> in this case, we have o3tl::cow_wrapper, which overrides operator* and operator-> <vmiklos> ah, and by the time you would add/remove the const, cow_wrapper already did the expensive task of copying based on const/non-const <noelgrandin> exactly <thorsten> heh Change-Id: I5366e6a87c414b862668b61e6adfbccfdd9d3b04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126473 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/xoutdev/_xpoly.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/svx/source/xoutdev/_xpoly.cxx b/svx/source/xoutdev/_xpoly.cxx
index c4d74b996735..5cdbdacc93a3 100644
--- a/svx/source/xoutdev/_xpoly.cxx
+++ b/svx/source/xoutdev/_xpoly.cxx
@@ -322,7 +322,7 @@ XPolygon::~XPolygon() = default;
void XPolygon::SetPointCount( sal_uInt16 nPoints )
{
- std::as_const(*pImpXPolygon).CheckPointDelete();
+ std::as_const(pImpXPolygon)->CheckPointDelete();
if( pImpXPolygon->nSize < nPoints )
pImpXPolygon->Resize( nPoints );
@@ -425,7 +425,7 @@ const Point& XPolygon::operator[]( sal_uInt16 nPos ) const
Point& XPolygon::operator[]( sal_uInt16 nPos )
{
- std::as_const(*pImpXPolygon).CheckPointDelete();
+ std::as_const(pImpXPolygon)->CheckPointDelete();
if( nPos >= pImpXPolygon->nSize )
{
@@ -458,7 +458,7 @@ PolyFlags XPolygon::GetFlags( sal_uInt16 nPos ) const
/// set the flags for the point at the given position
void XPolygon::SetFlags( sal_uInt16 nPos, PolyFlags eFlags )
{
- std::as_const(*pImpXPolygon).CheckPointDelete();
+ std::as_const(pImpXPolygon)->CheckPointDelete();
pImpXPolygon->pFlagAry[nPos] = eFlags;
}
@@ -741,7 +741,7 @@ void XPolygon::PointsToBezier(sal_uInt16 nFirst)
/// scale in X- and/or Y-direction
void XPolygon::Scale(double fSx, double fSy)
{
- std::as_const(*pImpXPolygon).CheckPointDelete();
+ std::as_const(pImpXPolygon)->CheckPointDelete();
sal_uInt16 nPntCnt = pImpXPolygon->nPoints;
@@ -766,7 +766,7 @@ void XPolygon::Scale(double fSx, double fSy)
void XPolygon::Distort(const tools::Rectangle& rRefRect,
const XPolygon& rDistortedRect)
{
- std::as_const(*pImpXPolygon).CheckPointDelete();
+ std::as_const(pImpXPolygon)->CheckPointDelete();
tools::Long Xr, Wr;
tools::Long Yr, Hr;