From df9e895763d7887baef7fe14c035aff25b99be7e Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 28 Sep 2018 11:24:26 +0200 Subject: loplugin:useuniqueptr in hierarchy_ucp::DataSupplier_Impl Change-Id: I56259038649419b5ef02d911c20358d8a8d56917 Reviewed-on: https://gerrit.libreoffice.org/61118 Tested-by: Jenkins Reviewed-by: Noel Grandin --- ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'ucb/source') diff --git a/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx b/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx index f7d9a8daec73..13e6eea30ead 100644 --- a/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx +++ b/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx @@ -57,7 +57,7 @@ struct ResultListEntry // ResultList. -typedef std::vector< ResultListEntry* > ResultList; +typedef std::vector< std::unique_ptr > ResultList; // struct DataSupplier_Impl. @@ -84,22 +84,9 @@ struct DataSupplier_Impl rContent->getProvider().get() ), rContent->getIdentifier()->getContentIdentifier() ), m_nOpenMode( nOpenMode ), m_bCountFinal( false ) {} - ~DataSupplier_Impl(); }; -DataSupplier_Impl::~DataSupplier_Impl() -{ - ResultList::const_iterator it = m_aResults.begin(); - ResultList::const_iterator end = m_aResults.end(); - - while ( it != end ) - { - delete *it; - ++it; - } -} - } @@ -247,7 +234,7 @@ bool HierarchyResultSetDataSupplier::getResult( sal_uInt32 nIndex ) const HierarchyEntryData& rResult = *m_pImpl->m_aIterator; if ( checkResult( rResult ) ) { - m_pImpl->m_aResults.push_back( new ResultListEntry( rResult ) ); + m_pImpl->m_aResults.emplace_back( new ResultListEntry( rResult ) ); if ( nPos == nIndex ) { @@ -294,7 +281,7 @@ sal_uInt32 HierarchyResultSetDataSupplier::totalCount() { const HierarchyEntryData& rResult = *m_pImpl->m_aIterator; if ( checkResult( rResult ) ) - m_pImpl->m_aResults.push_back( new ResultListEntry( rResult ) ); + m_pImpl->m_aResults.emplace_back( new ResultListEntry( rResult ) ); } m_pImpl->m_bCountFinal = true; -- cgit