summaryrefslogtreecommitdiff
path: root/l10ntools/inc/export.hxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-03-18 18:34:39 +0100
committerStephan Bergmann <sbergman@redhat.com>2019-03-18 21:24:23 +0100
commitdc2329fb66dc38f62a21b1afaca38529d7e40fa9 (patch)
tree9d70445837e07574bfc0998fe7df3c86b1e6ca54 /l10ntools/inc/export.hxx
parent8925bd2efca8dd07a3ac044ecbc6505bb7bfa0a6 (diff)
Remove broken MergeDataHashMap optimization
...which apparently didn't take into account that inserting into a std::unordered_map may invalidate iterators, which now started to cause build failures like > [PRP] dictionaries/hu_HU/dialog/hu_HU_de > warn:sal.osl:25175:25175:sal/osl/unx/thread.cxx:1026: RTL_TEXTENCODING_DONTKNOW -> _ASCII_US > .../gcc/trunk/inst/include/c++/9.0.1/debug/safe_iterator.h:307: > In function: > __gnu_debug::_Safe_iterator<_Iterator, _Sequence, _Category>::pointer > __gnu_debug::_Safe_iterator<_Iterator, _Sequence, > _Category>::operator->() const [with _Iterator = > std::__detail::_Node_iterator<std::pair<const rtl::OString, > std::unique_ptr<MergeData> >, false, true>; _Sequence = > std::__debug::unordered_map<rtl::OString, std::unique_ptr<MergeData> >; > _Category = std::forward_iterator_tag; > __gnu_debug::_Safe_iterator<_Iterator, _Sequence, _Category>::pointer = > std::pair<const rtl::OString, std::unique_ptr<MergeData> >*] > > Error: attempt to dereference a singular iterator. > > Objects involved in the operation: > iterator "this" @ 0x0x5a8228 { > type = std::__detail::_Node_iterator<std::pair<rtl::OString const, std::unique_ptr<MergeData, std::default_delete<MergeData> > >, false, true> (mutable iterator); > state = singular; > references sequence with type 'std::__debug::unordered_map<rtl::OString, std::unique_ptr<MergeData, std::default_delete<MergeData> >, std::hash<rtl::OString>, std::equal_to<rtl::OString>, std::allocator<std::pair<rtl::OString const, std::unique_ptr<MergeData, std::default_delete<MergeData> > > > >' @ 0x0x5a81c8 > } > /bin/sh: line 1: 25175 Aborted (core dumped) LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}"$I/program:$I/program" $W/LinkTarget/Executable/propex -i $S/dictionaries/hu_HU/dialog/hu_HU_en_US.properties -l de -m ${MERGEINPUT} -o $W/PropertiesTranslateTarget/dictionaries/hu_HU/dialog/hu_HU_de.properties > make[1]: *** [.../solenv/gbuild/Dictionary.mk:88: .../workdir/PropertiesTranslateTarget/dictionaries/hu_HU/dialog/hu_HU_de.properties] Error 134 with trunk libstdc++ in debug mode. Both classes MergeData and MergeDataHashMap became redundant. Change-Id: I771548a6155e14037d84acfd74cd13566a26a8d7 Reviewed-on: https://gerrit.libreoffice.org/69395 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'l10ntools/inc/export.hxx')
-rw-r--r--l10ntools/inc/export.hxx72
1 files changed, 2 insertions, 70 deletions
diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx
index 658faaf0450e..b6d958695b8d 100644
--- a/l10ntools/inc/export.hxx
+++ b/l10ntools/inc/export.hxx
@@ -119,74 +119,6 @@ public:
};
-
-// class MergeDataHashMap
-
-
-class MergeData;
-
-/** Container for MergeData
-
- This class is an HashMap with a hidden insertion
- order. The class can used just like a simple
- HashMap, but good to know that it's use is
- more effective if the accessing(find) order
- match with the insertion order.
-
- In the most case, this match is good.
- (e.g. reading PO files of different languages,
- executables merging)
-*/
-class MergeDataHashMap
-{
- private:
- typedef std::unordered_map<OString, std::unique_ptr<MergeData>> HashMap_t;
-
- public:
- MergeDataHashMap()
- : bFirstSearch(true)
- , aLastInsertion(m_aHashMap.end())
- , aLastFound(m_aHashMap.end())
- , aFirstInOrder(m_aHashMap.end())
- {
- }
-
- typedef HashMap_t::iterator iterator;
- typedef HashMap_t::const_iterator const_iterator;
-
- std::pair<iterator,bool> insert(const OString& rKey, std::unique_ptr<MergeData> pMergeData);
- iterator const & find(const OString& rKey);
-
- iterator end() {return m_aHashMap.end();}
-
- private:
- bool bFirstSearch;
- HashMap_t m_aHashMap;
- iterator aLastInsertion;
- iterator aLastFound;
- iterator aFirstInOrder;
-};
-
-
-// class MergeData
-
-
-/// Purpose: holds information of data to merge (one resource)
-class MergeData
-{
- friend class MergeDataHashMap;
-
- std::unique_ptr<MergeEntrys> pMergeEntrys;
- MergeDataHashMap::iterator m_aNextData;
-
-public:
- MergeData();
- ~MergeData();
- MergeEntrys* GetMergeEntries() { return pMergeEntrys.get();}
-
-};
-
-
// class MergeDataFile
@@ -194,10 +126,10 @@ public:
class MergeDataFile
{
private:
- MergeDataHashMap aMap;
+ std::unordered_map<OString, std::unique_ptr<MergeEntrys>> aMap;
std::set<OString> aLanguageSet;
- MergeData *GetMergeData( ResData *pResData , bool bCaseSensitive = false );
+ MergeEntrys *GetMergeData( ResData *pResData , bool bCaseSensitive = false );
void InsertEntry(const OString &rTYP, const OString &rGID,
const OString &rLID, const OString &nLang,
const OString &rTEXT, const OString &rQHTEXT,