From e5e0cc68f70d35e1849aeaf21c0ce68afd6a1f59 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 22 Oct 2018 09:32:39 +0100 Subject: pvs-studio: V794 The assignment operator should be protected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ia443a0e61a091d877c8da26bf7d45bf4261f8669 Reviewed-on: https://gerrit.libreoffice.org/62166 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- filter/source/graphicfilter/icgm/bundles.cxx | 43 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'filter') 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 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(pPtr->pFontName.get()) ) + 1; - pCFontEntry->pFontName.reset( new sal_Int8[ nSize ] ); - memcpy( pCFontEntry->pFontName.get(), pPtr->pFontName.get(), nSize ); + std::unique_ptr pCFontEntry(new FontEntry); + if ( pPtr->pFontName ) + { + sal_uInt32 nSize = strlen( reinterpret_cast(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(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(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; -- cgit