diff options
Diffstat (limited to 'l10ntools/source')
-rw-r--r-- | l10ntools/source/helpmerge.cxx | 5 | ||||
-rw-r--r-- | l10ntools/source/treemerge.cxx | 11 |
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(); |