diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-22 09:32:39 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-22 12:54:08 +0200 |
commit | e5e0cc68f70d35e1849aeaf21c0ce68afd6a1f59 (patch) | |
tree | b4bce95d15819feb2c38e183c3ccdcbab76db60c /filter | |
parent | fd56d5fd409c832886bf42a020322e69b6a35d9e (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 'filter')
-rw-r--r-- | filter/source/graphicfilter/icgm/bundles.cxx | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/filter/source/graphicfilter/icgm/bundles.cxx b/filter/source/graphicfilter/icgm/bundles.cxx index 8cce817c3800..c1b6277c88c1 100644 --- a/filter/source/graphicfilter/icgm/bundles.cxx +++ b/filter/source/graphicfilter/icgm/bundles.cxx @@ -51,36 +51,37 @@ CGMFList::~CGMFList() ImplDeleteList(); } - CGMFList& CGMFList::operator=( const CGMFList& rSource ) { - ImplDeleteList(); - nFontsAvailable = rSource.nFontsAvailable; - nFontNameCount = rSource.nFontNameCount; - nCharSetCount = rSource.nCharSetCount; - for (auto const & pPtr : rSource.aFontEntryList) + if (this != &rSource) { - std::unique_ptr<FontEntry> pCFontEntry(new FontEntry); - if ( pPtr->pFontName ) + ImplDeleteList(); + nFontsAvailable = rSource.nFontsAvailable; + nFontNameCount = rSource.nFontNameCount; + nCharSetCount = rSource.nCharSetCount; + for (auto const & pPtr : rSource.aFontEntryList) { - sal_uInt32 nSize = strlen( reinterpret_cast<char*>(pPtr->pFontName.get()) ) + 1; - pCFontEntry->pFontName.reset( new sal_Int8[ nSize ] ); - memcpy( pCFontEntry->pFontName.get(), pPtr->pFontName.get(), nSize ); + std::unique_ptr<FontEntry> pCFontEntry(new FontEntry); + if ( pPtr->pFontName ) + { + sal_uInt32 nSize = strlen( reinterpret_cast<char*>(pPtr->pFontName.get()) ) + 1; + pCFontEntry->pFontName.reset( new sal_Int8[ nSize ] ); + memcpy( pCFontEntry->pFontName.get(), pPtr->pFontName.get(), nSize ); + } + if ( pPtr->pCharSetValue ) + { + sal_uInt32 nSize = strlen( reinterpret_cast<char*>(pPtr->pCharSetValue.get()) ) + 1; + pCFontEntry->pCharSetValue.reset( new sal_Int8[ nSize ] ); + memcpy( pCFontEntry->pCharSetValue.get(), pPtr->pCharSetValue.get(), nSize ); + } + pCFontEntry->eCharSetType = pPtr->eCharSetType; + pCFontEntry->nFontType = pPtr->nFontType; + aFontEntryList.push_back( std::move(pCFontEntry) ); } - if ( pPtr->pCharSetValue ) - { - sal_uInt32 nSize = strlen( reinterpret_cast<char*>(pPtr->pCharSetValue.get()) ) + 1; - pCFontEntry->pCharSetValue.reset( new sal_Int8[ nSize ] ); - memcpy( pCFontEntry->pCharSetValue.get(), pPtr->pCharSetValue.get(), nSize ); - } - pCFontEntry->eCharSetType = pPtr->eCharSetType; - pCFontEntry->nFontType = pPtr->nFontType; - aFontEntryList.push_back( std::move(pCFontEntry) ); } return *this; } - FontEntry* CGMFList::GetFontEntry( sal_uInt32 nIndex ) { sal_uInt32 nInd = nIndex; |