summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-10-22 09:32:39 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-10-22 12:54:08 +0200
commite5e0cc68f70d35e1849aeaf21c0ce68afd6a1f59 (patch)
treeb4bce95d15819feb2c38e183c3ccdcbab76db60c /vcl
parentfd56d5fd409c832886bf42a020322e69b6a35d9e (diff)
pvs-studio: V794 The assignment operator should be protected
Change-Id: Ia443a0e61a091d877c8da26bf7d45bf4261f8669 Reviewed-on: https://gerrit.libreoffice.org/62166 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/animate.cxx22
-rw-r--r--vcl/source/gdi/regionband.cxx34
2 files changed, 30 insertions, 26 deletions
diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx
index 22519fa5b810..7e3cb72ac9cf 100644
--- a/vcl/source/gdi/animate.cxx
+++ b/vcl/source/gdi/animate.cxx
@@ -96,18 +96,20 @@ Animation::~Animation()
Animation& Animation::operator=( const Animation& rAnimation )
{
- Clear();
-
- for(auto const & i : rAnimation.maList)
- maList.emplace_back( new AnimationBitmap( *i ) );
+ if (this != &rAnimation)
+ {
+ Clear();
- maGlobalSize = rAnimation.maGlobalSize;
- maBitmapEx = rAnimation.maBitmapEx;
- mnLoopCount = rAnimation.mnLoopCount;
- mnPos = rAnimation.mnPos;
- mbLoopTerminated = rAnimation.mbLoopTerminated;
- mnLoops = mbLoopTerminated ? 0 : mnLoopCount;
+ for(auto const & i : rAnimation.maList)
+ maList.emplace_back( new AnimationBitmap( *i ) );
+ maGlobalSize = rAnimation.maGlobalSize;
+ maBitmapEx = rAnimation.maBitmapEx;
+ mnLoopCount = rAnimation.mnLoopCount;
+ mnPos = rAnimation.mnPos;
+ mbLoopTerminated = rAnimation.mbLoopTerminated;
+ mnLoops = mbLoopTerminated ? 0 : mnLoopCount;
+ }
return *this;
}
diff --git a/vcl/source/gdi/regionband.cxx b/vcl/source/gdi/regionband.cxx
index 50f0cecd6616..4cfee2a8d503 100644
--- a/vcl/source/gdi/regionband.cxx
+++ b/vcl/source/gdi/regionband.cxx
@@ -38,27 +38,29 @@ RegionBand::RegionBand(const RegionBand& rRef)
RegionBand& RegionBand::operator=(const RegionBand& rRef)
{
- ImplRegionBand* pPrevBand = nullptr;
- ImplRegionBand* pBand = rRef.mpFirstBand;
-
- while(pBand)
+ if (this != &rRef)
{
- ImplRegionBand* pNewBand = new ImplRegionBand(*pBand);
+ ImplRegionBand* pPrevBand = nullptr;
+ ImplRegionBand* pBand = rRef.mpFirstBand;
- // first element? -> set as first into the list
- if(pBand == rRef.mpFirstBand)
- {
- mpFirstBand = pNewBand;
- }
- else
+ while(pBand)
{
- pPrevBand->mpNextBand = pNewBand;
- }
+ ImplRegionBand* pNewBand = new ImplRegionBand(*pBand);
- pPrevBand = pNewBand;
- pBand = pBand->mpNextBand;
- }
+ // first element? -> set as first into the list
+ if(pBand == rRef.mpFirstBand)
+ {
+ mpFirstBand = pNewBand;
+ }
+ else
+ {
+ pPrevBand->mpNextBand = pNewBand;
+ }
+ pPrevBand = pNewBand;
+ pBand = pBand->mpNextBand;
+ }
+ }
return *this;
}