diff options
Diffstat (limited to 'l10ntools')
-rw-r--r-- | l10ntools/inc/export.hxx | 4 | ||||
-rw-r--r-- | l10ntools/source/merge.cxx | 12 |
2 files changed, 7 insertions, 9 deletions
diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx index 0ed0f45c5175..5a9389ff7d19 100644 --- a/l10ntools/inc/export.hxx +++ b/l10ntools/inc/export.hxx @@ -151,7 +151,7 @@ class MergeData; class MergeDataHashMap { private: - typedef std::unordered_map<OString, MergeData*> HashMap_t; + typedef std::unordered_map<OString, std::unique_ptr<MergeData>> HashMap_t; public: MergeDataHashMap() @@ -165,7 +165,7 @@ class MergeDataHashMap typedef HashMap_t::iterator iterator; typedef HashMap_t::const_iterator const_iterator; - std::pair<iterator,bool> insert(const OString& rKey, MergeData* pMergeData); + std::pair<iterator,bool> insert(const OString& rKey, std::unique_ptr<MergeData> pMergeData); iterator const & find(const OString& rKey); iterator begin() {return m_aHashMap.begin();} diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index 66aca214467d..4e55b45a6942 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -111,9 +111,9 @@ OString MergeEntrys::GetQTZText(const ResData& rResData, const OString& rOrigTex // class MergeDataHashMap -std::pair<MergeDataHashMap::iterator,bool> MergeDataHashMap::insert(const OString& rKey, MergeData* pMergeData) +std::pair<MergeDataHashMap::iterator,bool> MergeDataHashMap::insert(const OString& rKey, std::unique_ptr<MergeData> pMergeData) { - std::pair<iterator,bool> aTemp = m_aHashMap.emplace( rKey, pMergeData ); + std::pair<iterator,bool> aTemp = m_aHashMap.emplace( rKey, std::move(pMergeData) ); if( m_aHashMap.size() == 1 ) { // When first insert, set an iterator to the first element @@ -296,8 +296,6 @@ MergeDataFile::MergeDataFile( MergeDataFile::~MergeDataFile() { - for (auto const& elem : aMap) - delete elem.second; } std::vector<OString> MergeDataFile::GetLanguages() const @@ -325,7 +323,7 @@ MergeData *MergeDataFile::GetMergeData( ResData *pResData , bool bCaseSensitive { pResData->sGId = sOldG; pResData->sId = sOldL; - return mit->second; + return mit->second.get(); } pResData->sGId = sOldG; pResData->sId = sOldL; @@ -366,14 +364,14 @@ void MergeDataFile::InsertEntry( { MergeDataHashMap::const_iterator mit = aMap.find( sKey ); if(mit != aMap.end()) - pData = mit->second; + pData = mit->second.get(); } if( !pData ) { pData = new MergeData; - aMap.insert( sKey, pData ); + aMap.insert( sKey, std::unique_ptr<MergeData>(pData) ); } |