[Libreoffice-commits] core.git: 2 commits - sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Thu Jul 17 11:30:24 PDT 2014


 sc/source/filter/inc/XclExpChangeTrack.hxx   |    9 +++-
 sc/source/filter/xcl97/XclExpChangeTrack.cxx |   54 +++++++++++----------------
 2 files changed, 29 insertions(+), 34 deletions(-)

New commits:
commit c003fca9f077958f4c73a80f56634e08c454b4e7
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Jul 17 13:39:17 2014 -0400

    And this too.
    
    Change-Id: Ie8772de1d5b56b994c951ada09ee54afffceeb4f

diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx
index c650d36..2ef29b7 100644
--- a/sc/source/filter/inc/XclExpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclExpChangeTrack.hxx
@@ -570,10 +570,11 @@ public:
 class XclExpChangeTrack : protected XclExpRoot
 {
     typedef boost::ptr_vector<ExcRecord> RecListType;
+    typedef boost::ptr_vector<XclExpChTrTabIdBuffer> TabIdBufferType;
     RecListType maRecList;           // list of "Revision Log" stream records
     std::stack<XclExpChTrAction*> aActionStack;
     XclExpChTrTabIdBuffer*        pTabIdBuffer;
-    std::vector<XclExpChTrTabIdBuffer*> maBuffers;
+    TabIdBufferType maBuffers;
 
     ScDocument*                 pTempDoc;           // empty document
 
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index c96169a..9b4d5d0 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -1459,10 +1459,6 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) :
 
 XclExpChangeTrack::~XclExpChangeTrack()
 {
-    std::vector<XclExpChTrTabIdBuffer*>::iterator pIter;
-    for ( pIter = maBuffers.begin(); pIter != maBuffers.end(); ++pIter )
-        delete *pIter;
-
     while( !aActionStack.empty() )
     {
         delete aActionStack.top();
commit 1409c9b703530beaa2bf4118f1501d675f8a535e
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Jul 17 13:36:41 2014 -0400

    We can use ptr_vector for this.
    
    Change-Id: I3972fb23557f61ce3dbe0e671ed4c3f434a98f8b

diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx
index 2bfa1bb..c650d36 100644
--- a/sc/source/filter/inc/XclExpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclExpChangeTrack.hxx
@@ -29,6 +29,8 @@
 #include "ftools.hxx"
 #include "excrecds.hxx"
 
+#include <boost/ptr_container/ptr_vector.hpp>
+
 // XclExpUserBView - one UserBView record for each user
 
 class XclExpUserBView : public ExcRecord
@@ -567,8 +569,8 @@ public:
 
 class XclExpChangeTrack : protected XclExpRoot
 {
-private:
-    std::vector<ExcRecord*>       aRecList;           // list of "Revision Log" stream records
+    typedef boost::ptr_vector<ExcRecord> RecListType;
+    RecListType maRecList;           // list of "Revision Log" stream records
     std::stack<XclExpChTrAction*> aActionStack;
     XclExpChTrTabIdBuffer*        pTabIdBuffer;
     std::vector<XclExpChTrTabIdBuffer*> maBuffers;
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index 8cc504f..c96169a 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -1408,10 +1408,10 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) :
 
     // build record list
     pHeader = new XclExpChTrHeader;
-    aRecList.push_back( new StartXmlElement( XML_headers, StartXmlElement::WRITE_NAMESPACES ) );
-    aRecList.push_back( pHeader );
-    aRecList.push_back( new XclExpChTr0x0195 );
-    aRecList.push_back( new XclExpChTr0x0194( *pTempChangeTrack ) );
+    maRecList.push_back( new StartXmlElement( XML_headers, StartXmlElement::WRITE_NAMESPACES ) );
+    maRecList.push_back( pHeader );
+    maRecList.push_back( new XclExpChTr0x0195 );
+    maRecList.push_back( new XclExpChTr0x0194( *pTempChangeTrack ) );
 
     OUString sLastUsername;
     DateTime aLastDateTime( DateTime::EMPTY );
@@ -1428,41 +1428,37 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) :
         {
             if( nIndex != 1 )
             {
-                aRecList.push_back( new EndXmlElement( XML_revisions ) );
-                aRecList.push_back( new EndHeaderElement() );
+                maRecList.push_back( new EndXmlElement( XML_revisions ) );
+                maRecList.push_back( new EndHeaderElement() );
             }
 
             lcl_GenerateGUID( aGUID, bValidGUID );
             sLastUsername = pAction->GetUsername();
             aLastDateTime = pAction->GetDateTime();
 
-            aRecList.push_back( new StartXmlElement( XML_header, 0 ) );
-            aRecList.push_back( new XclExpChTrInfo( sLastUsername, aLastDateTime, aGUID, nLogNumber++ ) );
-            aRecList.push_back( new XclExpChTrTabId( pAction->GetTabIdBuffer(), true ) );
-            aRecList.push_back( new StartXmlElement( XML_revisions, StartXmlElement::WRITE_NAMESPACES | StartXmlElement::CLOSE_ELEMENT ) );
+            maRecList.push_back( new StartXmlElement( XML_header, 0 ) );
+            maRecList.push_back( new XclExpChTrInfo( sLastUsername, aLastDateTime, aGUID, nLogNumber++ ) );
+            maRecList.push_back( new XclExpChTrTabId( pAction->GetTabIdBuffer(), true ) );
+            maRecList.push_back( new StartXmlElement( XML_revisions, StartXmlElement::WRITE_NAMESPACES | StartXmlElement::CLOSE_ELEMENT ) );
             pHeader->SetGUID( aGUID );
         }
         pAction->SetIndex( nIndex );
-        aRecList.push_back( pAction );
+        maRecList.push_back( pAction );
     }
 
     pHeader->SetGUID( aGUID );
     pHeader->SetCount( nIndex - 1 );
     if( nLogNumber > 1 )
     {
-        aRecList.push_back( new EndXmlElement( XML_revisions ) );
-        aRecList.push_back( new EndHeaderElement() );
+        maRecList.push_back( new EndXmlElement( XML_revisions ) );
+        maRecList.push_back( new EndHeaderElement() );
     }
-    aRecList.push_back( new EndXmlElement( XML_headers ) );
-    aRecList.push_back( new ExcEof );
+    maRecList.push_back( new EndXmlElement( XML_headers ) );
+    maRecList.push_back( new ExcEof );
 }
 
 XclExpChangeTrack::~XclExpChangeTrack()
 {
-    std::vector<ExcRecord*>::iterator prIter;
-    for ( prIter = aRecList.begin(); prIter != aRecList.end(); ++prIter )
-        delete *prIter;
-
     std::vector<XclExpChTrTabIdBuffer*>::iterator pIter;
     for ( pIter = maBuffers.begin(); pIter != maBuffers.end(); ++pIter )
         delete *pIter;
@@ -1561,7 +1557,7 @@ bool XclExpChangeTrack::WriteUserNamesStream()
 
 void XclExpChangeTrack::Write()
 {
-    if( aRecList.empty() )
+    if (maRecList.empty())
         return;
 
     if( WriteUserNamesStream() )
@@ -1572,9 +1568,9 @@ void XclExpChangeTrack::Write()
         {
             XclExpStream aXclStrm( *xSvStrm, GetRoot(), EXC_MAXRECSIZE_BIFF8 + 8 );
 
-            std::vector<ExcRecord*>::iterator pIter;
-            for ( pIter = aRecList.begin(); pIter != aRecList.end(); ++pIter )
-                (*pIter)->Save(aXclStrm);
+            RecListType::iterator pIter;
+            for (pIter = maRecList.begin(); pIter != maRecList.end(); ++pIter)
+                pIter->Save(aXclStrm);
 
             xSvStrm->Commit();
         }
@@ -1602,7 +1598,7 @@ static void lcl_WriteUserNamesXml( XclExpXmlStream& rWorkbookStrm )
 
 void XclExpChangeTrack::WriteXml( XclExpXmlStream& rWorkbookStrm )
 {
-    if( aRecList.empty() )
+    if (maRecList.empty())
         return;
 
     lcl_WriteUserNamesXml( rWorkbookStrm );
@@ -1618,9 +1614,9 @@ void XclExpChangeTrack::WriteXml( XclExpXmlStream& rWorkbookStrm )
     //          contents of XclExpChangeTrack::WriteUserNamesStream()).
     rWorkbookStrm.PushStream( pRevisionHeaders );
 
-    std::vector<ExcRecord*>::iterator pIter;
-    for ( pIter = aRecList.begin(); pIter != aRecList.end(); ++pIter )
-        (*pIter)->SaveXml(rWorkbookStrm);
+    RecListType::iterator pIter;
+    for (pIter = maRecList.begin(); pIter != maRecList.end(); ++pIter)
+        pIter->SaveXml(rWorkbookStrm);
 
     rWorkbookStrm.PopStream();
 }


More information about the Libreoffice-commits mailing list