summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-03 15:08:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-05-07 08:32:28 +0200
commit945642c28971efc89d3bbc5e474814b19ba2a76c (patch)
tree054f6db6d5608f6afec07ef16d62bf61e6f3e4a2 /filter
parent2834d503d683c7a125b24e49f0127d43cb2501e9 (diff)
loplugin:useuniqueptr in CGMFList
Change-Id: I2ad0995c9ef9e04efb4ee3dad9c1a879303c8dbd Reviewed-on: https://gerrit.libreoffice.org/53873 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/graphicfilter/icgm/bundles.cxx18
-rw-r--r--filter/source/graphicfilter/icgm/bundles.hxx2
2 files changed, 9 insertions, 11 deletions
diff --git a/filter/source/graphicfilter/icgm/bundles.cxx b/filter/source/graphicfilter/icgm/bundles.cxx
index 13bddfdcf0ec..3b0fb067b877 100644
--- a/filter/source/graphicfilter/icgm/bundles.cxx
+++ b/filter/source/graphicfilter/icgm/bundles.cxx
@@ -112,9 +112,9 @@ CGMFList& CGMFList::operator=( const CGMFList& rSource )
nFontsAvailable = rSource.nFontsAvailable;
nFontNameCount = rSource.nFontNameCount;
nCharSetCount = rSource.nCharSetCount;
- for (FontEntry* pPtr : rSource.aFontEntryList)
+ for (auto const & pPtr : rSource.aFontEntryList)
{
- FontEntry* pCFontEntry = new FontEntry;
+ std::unique_ptr<FontEntry> pCFontEntry(new FontEntry);
if ( pPtr->pFontName )
{
sal_uInt32 nSize = strlen( reinterpret_cast<char*>(pPtr->pFontName.get()) ) + 1;
@@ -129,7 +129,7 @@ CGMFList& CGMFList::operator=( const CGMFList& rSource )
}
pCFontEntry->eCharSetType = pPtr->eCharSetType;
pCFontEntry->nFontType = pPtr->nFontType;
- aFontEntryList.push_back( pCFontEntry );
+ aFontEntryList.push_back( std::move(pCFontEntry) );
}
return *this;
}
@@ -140,7 +140,7 @@ FontEntry* CGMFList::GetFontEntry( sal_uInt32 nIndex )
sal_uInt32 nInd = nIndex;
if ( nInd )
nInd--;
- return ( nInd < aFontEntryList.size() ) ? aFontEntryList[ nInd ] : nullptr;
+ return ( nInd < aFontEntryList.size() ) ? aFontEntryList[ nInd ].get() : nullptr;
}
@@ -168,11 +168,11 @@ void CGMFList::InsertName( sal_uInt8 const * pSource, sal_uInt32 nSize )
{
nFontsAvailable++;
pFontEntry = new FontEntry;
- aFontEntryList.push_back( pFontEntry );
+ aFontEntryList.push_back( std::unique_ptr<FontEntry>(pFontEntry) );
}
else
{
- pFontEntry = aFontEntryList[ nFontNameCount ];
+ pFontEntry = aFontEntryList[ nFontNameCount ].get();
}
nFontNameCount++;
std::unique_ptr<sal_Int8[]> pBuf(new sal_Int8[ nSize ]);
@@ -229,11 +229,11 @@ void CGMFList::InsertCharSet( CharSetType eCharSetType, sal_uInt8 const * pSourc
{
nFontsAvailable++;
pFontEntry = new FontEntry;
- aFontEntryList.push_back( pFontEntry );
+ aFontEntryList.push_back( std::unique_ptr<FontEntry>(pFontEntry) );
}
else
{
- pFontEntry = aFontEntryList[ nCharSetCount ];
+ pFontEntry = aFontEntryList[ nCharSetCount ].get();
}
nCharSetCount++;
pFontEntry->eCharSetType = eCharSetType;
@@ -245,8 +245,6 @@ void CGMFList::InsertCharSet( CharSetType eCharSetType, sal_uInt8 const * pSourc
void CGMFList::ImplDeleteList()
{
- for (FontEntry* i : aFontEntryList)
- delete i;
aFontEntryList.clear();
}
diff --git a/filter/source/graphicfilter/icgm/bundles.hxx b/filter/source/graphicfilter/icgm/bundles.hxx
index 51e92567a534..cf1516e2c5a1 100644
--- a/filter/source/graphicfilter/icgm/bundles.hxx
+++ b/filter/source/graphicfilter/icgm/bundles.hxx
@@ -159,7 +159,7 @@ class CGMFList
{
sal_uInt32 nFontNameCount;
sal_uInt32 nCharSetCount;
- ::std::vector< FontEntry* >
+ ::std::vector< std::unique_ptr<FontEntry> >
aFontEntryList;
void ImplDeleteList();