[Libreoffice-commits] .: l10ntools/inc l10ntools/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Dec 11 14:21:08 PST 2012


 l10ntools/inc/po.hxx       |    4 +---
 l10ntools/source/merge.cxx |   15 ---------------
 l10ntools/source/po.cxx    |   38 +++++++++-----------------------------
 3 files changed, 10 insertions(+), 47 deletions(-)

New commits:
commit dddca20c4871c7f7694510123f2366c3a179c06c
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date:   Tue Dec 11 19:11:35 2012 +0100

    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

diff --git a/l10ntools/inc/po.hxx b/l10ntools/inc/po.hxx
index ace9e09..a84b5a0 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 4f065fb..34f590c 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 c59a4f8..8d51671 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() )


More information about the Libreoffice-commits mailing list