summaryrefslogtreecommitdiff
path: root/svl
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 /svl
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 'svl')
-rw-r--r--svl/source/items/macitem.cxx7
-rw-r--r--svl/source/passwordcontainer/passwordcontainer.hxx12
2 files changed, 12 insertions, 7 deletions
diff --git a/svl/source/items/macitem.cxx b/svl/source/items/macitem.cxx
index b8e56d9f0ed4..f18a575bf2df 100644
--- a/svl/source/items/macitem.cxx
+++ b/svl/source/items/macitem.cxx
@@ -68,8 +68,11 @@ SvxMacro& SvxMacro::operator=( const SvxMacro& rBase )
SvxMacroTableDtor& SvxMacroTableDtor::operator=( const SvxMacroTableDtor& rTbl )
{
- aSvxMacroTable.clear();
- aSvxMacroTable.insert(rTbl.aSvxMacroTable.begin(), rTbl.aSvxMacroTable.end());
+ if (this != &rTbl)
+ {
+ aSvxMacroTable.clear();
+ aSvxMacroTable.insert(rTbl.aSvxMacroTable.begin(), rTbl.aSvxMacroTable.end());
+ }
return *this;
}
diff --git a/svl/source/passwordcontainer/passwordcontainer.hxx b/svl/source/passwordcontainer/passwordcontainer.hxx
index 3da1e606d4d1..ad62ac0c91bd 100644
--- a/svl/source/passwordcontainer/passwordcontainer.hxx
+++ b/svl/source/passwordcontainer/passwordcontainer.hxx
@@ -96,12 +96,14 @@ public:
NamePassRecord& operator=( const NamePassRecord& aRecord )
{
- m_aName = aRecord.m_aName;
-
- m_aMemPass.clear();
- m_aPersPass.clear();
- InitArrays( aRecord.m_bHasMemPass, aRecord.m_aMemPass, aRecord.m_bHasPersPass, aRecord.m_aPersPass );
+ if (this != &aRecord)
+ {
+ m_aName = aRecord.m_aName;
+ m_aMemPass.clear();
+ m_aPersPass.clear();
+ InitArrays( aRecord.m_bHasMemPass, aRecord.m_aMemPass, aRecord.m_bHasPersPass, aRecord.m_aPersPass );
+ }
return *this;
}