diff options
author | Zolnai Tamás <zolnaitamas2000g@gmail.com> | 2012-11-21 21:52:01 +0100 |
---|---|---|
committer | Zolnai Tamás <zolnaitamas2000g@gmail.com> | 2012-11-21 22:52:10 +0100 |
commit | 8ae3ddca7e99d2bdbaadd5e0c82de2f0fbd30f91 (patch) | |
tree | aad38959ee96ecd785c85257731723ae41944618 | |
parent | a9a3095266c13d45d196e1b33a8f9a4fd84e30ea (diff) |
Fix language id checking
The result of GetLanguages() is a vector, but
behind it the language ids stored in a set, so
the order not depend on which id was inserted first.
With language ids which are after qtz in alphabetic order
this checkings works wrong.
Change-Id: I4e15d4de576b1fc567692109311c053b0d93ea60
-rw-r--r-- | l10ntools/source/propmerge.cxx | 8 | ||||
-rw-r--r-- | l10ntools/source/treemerge.cxx | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/l10ntools/source/propmerge.cxx b/l10ntools/source/propmerge.cxx index 91ea78b048ee..a4440e96d79d 100644 --- a/l10ntools/source/propmerge.cxx +++ b/l10ntools/source/propmerge.cxx @@ -182,13 +182,15 @@ void PropParser::Merge( const OString &rMergeSrc, const OString &rDestinationFil MergeDataFile aMergeDataFile( rMergeSrc, m_sSource, false ); - const std::vector<OString> aLanguages = aMergeDataFile.GetLanguages(); - if( m_sLang != "qtz" && !aLanguages.empty() && aLanguages[0] != m_sLang ) + const std::vector<OString> vLanguages = aMergeDataFile.GetLanguages(); + if( m_sLang != "qtz" && vLanguages.size()>=2 && + vLanguages[vLanguages[0]!="qtz" ? 0 : 1] != m_sLang ) { std::cerr << "Propex error: given language conflicts with " << "language of Mergedata file: " - << m_sLang.getStr() << " - " << aLanguages[0].getStr() << std::endl; + << m_sLang.getStr() << " - " + << vLanguages[vLanguages[0]!="qtz" ? 0 : 1].getStr() << std::endl; return; } diff --git a/l10ntools/source/treemerge.cxx b/l10ntools/source/treemerge.cxx index ed96da2348a5..bc9596ceab16 100644 --- a/l10ntools/source/treemerge.cxx +++ b/l10ntools/source/treemerge.cxx @@ -282,12 +282,14 @@ void TreeParser::Merge( MergeDataFile aMergeDataFile( rMergeSrc, static_cast<OString>( m_pSource->name ), false ); const std::vector<OString> vLanguages = aMergeDataFile.GetLanguages(); - if( !vLanguages.empty() && vLanguages[0] != m_sLang ) + if( vLanguages.size()>=2 && + vLanguages[vLanguages[0]=="qtz" ? 0 : 1] != m_sLang ) { std::cerr << "Treex error: given language conflicts with " << "language of Mergedata file: " - << m_sLang.getStr() << " - " << vLanguages[0].getStr() << std::endl; + << m_sLang.getStr() << " - " + << vLanguages[vLanguages[0]=="qtz" ? 0 : 1].getStr() << std::endl; return; } lcl_MergeLevel( |