summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-09-04 09:52:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-05 09:28:55 +0200
commit1fd4927817df1134749ec7b69620c49b0089e00b (patch)
treeb46d233cb9d737765fab5941298870b350469df0 /l10ntools
parent06951f8c14d6b8861af58bbb6b7f61a00b378a1c (diff)
loplugin:useuniqueptr in l10ntools
Change-Id: I8aaab2f3055bd0856926803ee7f71107b7cb1851 Reviewed-on: https://gerrit.libreoffice.org/59994 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/source/helpmerge.cxx5
-rw-r--r--l10ntools/source/treemerge.cxx11
2 files changed, 7 insertions, 9 deletions
diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx
index 0a2e3c3dfd52..663b4a945a1a 100644
--- a/l10ntools/source/helpmerge.cxx
+++ b/l10ntools/source/helpmerge.cxx
@@ -150,14 +150,13 @@ bool HelpParser::Merge( const OString &rDestinationFile,
//TODO: explicit BOM handling?
- XMLFile* xmlfile = aParser.Execute( sHelpFile, new XMLFile( OString('0') ) );
+ std::unique_ptr<XMLFile> xmlfile(aParser.Execute( sHelpFile, new XMLFile( OString('0') ) ));
if (!xmlfile)
{
SAL_WARN("l10ntools", "could not parse " << sHelpFile);
return false;
}
- MergeSingleFile( xmlfile , pMergeDataFile , rLanguage , rDestinationFile );
- delete xmlfile;
+ MergeSingleFile( xmlfile.get() , pMergeDataFile , rLanguage , rDestinationFile );
return true;
}
diff --git a/l10ntools/source/treemerge.cxx b/l10ntools/source/treemerge.cxx
index 791c1aebf52a..c874603edfa2 100644
--- a/l10ntools/source/treemerge.cxx
+++ b/l10ntools/source/treemerge.cxx
@@ -253,11 +253,11 @@ void TreeParser::Merge(
assert( m_bIsInitialized );
const xmlNodePtr pRootNode = xmlDocGetRootElement( m_pSource );
- MergeDataFile* pMergeDataFile = nullptr;
+ std::unique_ptr<MergeDataFile> pMergeDataFile;
if( m_sLang != "qtz" && m_sLang != "en-US" )
{
- pMergeDataFile = new MergeDataFile(
- rMergeSrc, static_cast<OString>( m_pSource->name ), false, false );
+ pMergeDataFile.reset(new MergeDataFile(
+ rMergeSrc, static_cast<OString>( m_pSource->name ), false, false ));
const std::vector<OString> vLanguages = pMergeDataFile->GetLanguages();
if( vLanguages.size()>=1 && vLanguages[0] != m_sLang )
{
@@ -266,15 +266,14 @@ void TreeParser::Merge(
" Mergedata file: ")
<< m_sLang << " - "
<< vLanguages[0] << std::endl;
- delete pMergeDataFile;
return;
}
}
lcl_MergeLevel(
m_pSource, pRootNode, reinterpret_cast<const xmlChar *>("help_section"),
- pMergeDataFile, m_sLang, rXhpRoot );
+ pMergeDataFile.get(), m_sLang, rXhpRoot );
- delete pMergeDataFile;
+ pMergeDataFile.reset();
xmlSaveFile( rDestinationFile.getStr(), m_pSource );
xmlFreeDoc( m_pSource );
xmlCleanupParser();