Kaydet (Commit) cfb59817 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in ImageListsDescriptor

Change-Id: I165af348b6d8863a4b1e5dd164d92c29f49d09c0
Reviewed-on: https://gerrit.libreoffice.org/48423Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 570786e7
...@@ -76,12 +76,10 @@ typedef std::vector<std::unique_ptr<ImageListItemDescriptor> > ImageListDescript ...@@ -76,12 +76,10 @@ typedef std::vector<std::unique_ptr<ImageListItemDescriptor> > ImageListDescript
struct ImageListsDescriptor struct ImageListsDescriptor
{ {
ImageListsDescriptor() : pImageList( nullptr ), ImageListsDescriptor() {}
pExternalImageList( nullptr ) {}
~ImageListsDescriptor() { delete pImageList; delete pExternalImageList; }
ImageListDescriptor* pImageList; std::unique_ptr<ImageListDescriptor> pImageList;
ExternalImageItemListDescriptor* pExternalImageList; std::unique_ptr<ExternalImageItemListDescriptor> pExternalImageList;
}; };
class ImagesConfiguration class ImagesConfiguration
......
...@@ -400,7 +400,7 @@ bool ImageManagerImpl::implts_storeUserImages( ...@@ -400,7 +400,7 @@ bool ImageManagerImpl::implts_storeUserImages(
if ( pImageList->GetImageCount() > 0 ) if ( pImageList->GetImageCount() > 0 )
{ {
ImageListsDescriptor aUserImageListInfo; ImageListsDescriptor aUserImageListInfo;
aUserImageListInfo.pImageList = new ImageListDescriptor; aUserImageListInfo.pImageList.reset( new ImageListDescriptor );
ImageListItemDescriptor* pList = new ImageListItemDescriptor; ImageListItemDescriptor* pList = new ImageListItemDescriptor;
aUserImageListInfo.pImageList->push_back( std::unique_ptr<ImageListItemDescriptor>(pList) ); aUserImageListInfo.pImageList->push_back( std::unique_ptr<ImageListItemDescriptor>(pList) );
......
...@@ -197,7 +197,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement( ...@@ -197,7 +197,7 @@ void SAL_CALL OReadImagesDocumentHandler::startElement(
} }
if ( !m_aImageList.pImageList ) if ( !m_aImageList.pImageList )
m_aImageList.pImageList = new ImageListDescriptor; m_aImageList.pImageList.reset( new ImageListDescriptor );
m_bImagesStartFound = true; m_bImagesStartFound = true;
m_pImages = new ImageListItemDescriptor; m_pImages = new ImageListItemDescriptor;
...@@ -511,7 +511,7 @@ void SAL_CALL OReadImagesDocumentHandler::endElement(const OUString& aName) ...@@ -511,7 +511,7 @@ void SAL_CALL OReadImagesDocumentHandler::endElement(const OUString& aName)
if ( m_pExternalImages && !m_aImageList.pExternalImageList ) if ( m_pExternalImages && !m_aImageList.pExternalImageList )
{ {
if ( !m_aImageList.pExternalImageList ) if ( !m_aImageList.pExternalImageList )
m_aImageList.pExternalImageList = m_pExternalImages; m_aImageList.pExternalImageList.reset( m_pExternalImages );
} }
m_bExternalImagesStartFound = false; m_bExternalImagesStartFound = false;
...@@ -614,7 +614,7 @@ void OWriteImagesDocumentHandler::WriteImagesDocument() ...@@ -614,7 +614,7 @@ void OWriteImagesDocumentHandler::WriteImagesDocument()
if ( m_aImageListsItems.pImageList ) if ( m_aImageListsItems.pImageList )
{ {
ImageListDescriptor* pImageList = m_aImageListsItems.pImageList; ImageListDescriptor* pImageList = m_aImageListsItems.pImageList.get();
for ( size_t i = 0; i < m_aImageListsItems.pImageList->size(); i++ ) for ( size_t i = 0; i < m_aImageListsItems.pImageList->size(); i++ )
{ {
...@@ -625,7 +625,7 @@ void OWriteImagesDocumentHandler::WriteImagesDocument() ...@@ -625,7 +625,7 @@ void OWriteImagesDocumentHandler::WriteImagesDocument()
if ( m_aImageListsItems.pExternalImageList ) if ( m_aImageListsItems.pExternalImageList )
{ {
WriteExternalImageList( m_aImageListsItems.pExternalImageList ); WriteExternalImageList( m_aImageListsItems.pExternalImageList.get() );
} }
m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); m_xWriteDocumentHandler->ignorableWhitespace( OUString() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment