diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-16 08:42:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-17 08:38:43 +0200 |
commit | 76db1242ad6944dea42a09d3e5575a890bf6f7c2 (patch) | |
tree | 5e7cf849082272b0823768ad5282e1c89f0b7212 /xmloff | |
parent | 026e2623f7f498432e6dc970fb06145dfc77dc45 (diff) |
loplugin:useuniqueptr in XMLRedlineExport
Change-Id: I337b6c068e28a5cf69d9c0b6a30b480834d8a227
Reviewed-on: https://gerrit.libreoffice.org/57513
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/XMLRedlineExport.cxx | 12 | ||||
-rw-r--r-- | xmloff/source/text/XMLRedlineExport.hxx | 3 |
2 files changed, 5 insertions, 10 deletions
diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx index 4a0e076a3c78..6e23cd2d4743 100644 --- a/xmloff/source/text/XMLRedlineExport.cxx +++ b/xmloff/source/text/XMLRedlineExport.cxx @@ -71,12 +71,6 @@ XMLRedlineExport::XMLRedlineExport(SvXMLExport& rExp) XMLRedlineExport::~XMLRedlineExport() { - // delete changes lists - for (auto const& change : aChangeMap) - { - delete change.second; - } - aChangeMap.clear(); } @@ -129,7 +123,7 @@ void XMLRedlineExport::ExportChangesList( ChangesMapType::iterator aFind = aChangeMap.find(rText); if (aFind != aChangeMap.end()) { - ChangesVectorType* pChangesList = aFind->second; + ChangesVectorType* pChangesList = aFind->second.get(); // export only if changes are found if (pChangesList->size() > 0) @@ -160,11 +154,11 @@ void XMLRedlineExport::SetCurrentXText( if (aIter == aChangeMap.end()) { ChangesVectorType* pList = new ChangesVectorType; - aChangeMap[rText] = pList; + aChangeMap[rText].reset( pList ); pCurrentChangesList = pList; } else - pCurrentChangesList = aIter->second; + pCurrentChangesList = aIter->second.get(); } else { diff --git a/xmloff/source/text/XMLRedlineExport.hxx b/xmloff/source/text/XMLRedlineExport.hxx index 0d7ab3114401..22169d4a0b97 100644 --- a/xmloff/source/text/XMLRedlineExport.hxx +++ b/xmloff/source/text/XMLRedlineExport.hxx @@ -25,6 +25,7 @@ #include <com/sun/star/uno/Sequence.h> #include <vector> +#include <memory> #include <map> class SvXMLExport; @@ -43,7 +44,7 @@ typedef ::std::vector< // store a list of redline properties for each XText typedef ::std::map< css::uno::Reference< css::text::XText>, - ChangesVectorType* > ChangesMapType; + std::unique_ptr<ChangesVectorType> > ChangesMapType; /** |