diff options
author | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2012-12-11 19:11:35 +0100 |
---|---|---|
committer | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2012-12-11 22:30:29 +0100 |
commit | dddca20c4871c7f7694510123f2366c3a179c06c (patch) | |
tree | fa4a42b26ffbc68f29b3f0796f3b3ca5772969c4 /l10ntools | |
parent | 2462391f4cc2ffad4fb218afe83ce0ed38f45207 (diff) |
Skip poheader
Po headers can be various and they don not
contain any needed information for merge so
skip it without any checking.
Change-Id: I6d81b7c85bfdbfd961361d98131ed80ba304e9ba
Diffstat (limited to 'l10ntools')
-rw-r--r-- | l10ntools/inc/po.hxx | 4 | ||||
-rw-r--r-- | l10ntools/source/merge.cxx | 15 | ||||
-rw-r--r-- | l10ntools/source/po.cxx | 38 |
3 files changed, 10 insertions, 47 deletions
diff --git a/l10ntools/inc/po.hxx b/l10ntools/inc/po.hxx index ace9e09e3643..a84b5a0a58a2 100644 --- a/l10ntools/inc/po.hxx +++ b/l10ntools/inc/po.hxx @@ -122,12 +122,11 @@ class PoIfstream: private boost::noncopyable private: std::ifstream m_aInPut; - bool m_bIsAfterHeader; bool m_bEof; public: - enum Exception { INVALIDENTRY, INVALIDHEADER }; + enum Exception { INVALIDENTRY }; PoIfstream(); ~PoIfstream(); @@ -136,7 +135,6 @@ public: void open(const OString& rFileName); void close(); - void readHeader(PoHeader& rHeader); void readEntry(PoEntry& rPo); }; diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index 4f065fb2ef7e..34f590c4bccf 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -175,21 +175,6 @@ MergeDataFile::MergeDataFile( printf( "Warning : Can't open %s\n", sPoFileName.getStr() ); return; } - PoHeader aPoHeader; - try - { - aPoInput.readHeader( aPoHeader ); - } - catch( PoIfstream::Exception& aException ) - { - if( aException == PoIfstream::INVALIDHEADER ) - { - printf( - "Warning : %s has invalid header\n", - sPoFileName.getStr() ); - return; - } - } OString sLang; //Get language id from path diff --git a/l10ntools/source/po.cxx b/l10ntools/source/po.cxx index c59a4f8a4e31..8d51671e1d5b 100644 --- a/l10ntools/source/po.cxx +++ b/l10ntools/source/po.cxx @@ -735,7 +735,6 @@ void PoOfstream::writeEntry( const PoEntry& rPoEntry ) PoIfstream::PoIfstream() : m_aInPut() - , m_bIsAfterHeader( false ) , m_bEof( false ) { } @@ -752,7 +751,14 @@ void PoIfstream::open( const OString& rFileName ) { assert( !isOpen() ); m_aInPut.open( rFileName.getStr(), std::ios_base::in ); - m_bIsAfterHeader = false; + + //Skip header + std::string sTemp; + std::getline(m_aInPut,sTemp); + while( !sTemp.empty() && !m_aInPut.eof() ) + { + std::getline(m_aInPut,sTemp); + } m_bEof = false; } @@ -762,35 +768,9 @@ void PoIfstream::close() m_aInPut.close(); } -void PoIfstream::readHeader( PoHeader& rPoHeader ) -{ - assert( isOpen() && !eof() && !m_bIsAfterHeader ); - GenPoEntry aGenPo; - aGenPo.readFromFile( m_aInPut ); - if( !aGenPo.getExtractCom().isEmpty() && - aGenPo.getMsgId().isEmpty() && - !aGenPo.getMsgStr().isEmpty() ) - { - if( rPoHeader.m_pGenPo ) - { - *(rPoHeader.m_pGenPo) = aGenPo; - } - else - { - rPoHeader.m_pGenPo = new GenPoEntry( aGenPo ); - } - rPoHeader.m_bIsInitialized = true; - m_bIsAfterHeader = true; - } - else - { - throw INVALIDHEADER; - } -} - void PoIfstream::readEntry( PoEntry& rPoEntry ) { - assert( isOpen() && !eof() && m_bIsAfterHeader ); + assert( isOpen() && !eof() ); GenPoEntry aGenPo; aGenPo.readFromFile( m_aInPut ); if( aGenPo.isNull() ) |