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

Kohei Yoshida kohei.yoshida at collabora.com
Mon Jun 9 09:52:17 PDT 2014


 package/source/xstor/xstorage.cxx |   18 +++++++-----------
 package/source/xstor/xstorage.hxx |    9 +++++----
 2 files changed, 12 insertions(+), 15 deletions(-)

New commits:
commit acf56987b03e03e7e407f383928f58cfb030d9d2
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Mon Jun 9 12:49:55 2014 -0400

    Tuck this typedef inside struct scope where it's used.
    
    Change-Id: I2e225fb7afc58f1763e2fc4b9155aafc0e487f34

diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index fc538b6..d57feb5 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -317,7 +317,7 @@ OStorage_Impl::~OStorage_Impl()
         }
         else if ( !m_aReadOnlyWrapList.empty() )
         {
-            for ( OStorageList_Impl::iterator pStorageIter = m_aReadOnlyWrapList.begin();
+            for ( StorageHoldersType::iterator pStorageIter = m_aReadOnlyWrapList.begin();
                   pStorageIter != m_aReadOnlyWrapList.end(); ++pStorageIter )
             {
                 uno::Reference< embed::XStorage > xTmp = pStorageIter->m_xWeakRef;
@@ -416,7 +416,7 @@ void OStorage_Impl::SetReadOnlyWrap( OStorage& aStorage )
 
 void OStorage_Impl::RemoveReadOnlyWrap( OStorage& aStorage )
 {
-    for ( OStorageList_Impl::iterator pStorageIter = m_aReadOnlyWrapList.begin();
+    for ( StorageHoldersType::iterator pStorageIter = m_aReadOnlyWrapList.begin();
       pStorageIter != m_aReadOnlyWrapList.end();)
     {
         uno::Reference< embed::XStorage > xTmp = pStorageIter->m_xWeakRef;
@@ -430,7 +430,7 @@ void OStorage_Impl::RemoveReadOnlyWrap( OStorage& aStorage )
                 AddLog( rException.Message );
             }
 
-            OStorageList_Impl::iterator pIterToDelete( pStorageIter );
+            StorageHoldersType::iterator pIterToDelete( pStorageIter );
             ++pStorageIter;
             m_aReadOnlyWrapList.erase( pIterToDelete );
         }
diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx
index 00d4a0b..b7bb5be 100644
--- a/package/source/xstor/xstorage.hxx
+++ b/package/source/xstor/xstorage.hxx
@@ -50,6 +50,8 @@
 
 #include "mutexholder.hxx"
 
+#include <list>
+
 namespace com { namespace sun { namespace star { namespace uno {
     class XComponentContext;
 } } } }
@@ -89,7 +91,6 @@ public:
                                 ~SotElement_Impl();
 };
 
-#include <list>
 typedef ::std::list< SotElement_Impl* > SotElementList_Impl;
 
 // Main storage implementation
@@ -115,15 +116,15 @@ struct StorageHolder_Impl
     }
 };
 
-typedef ::std::list< StorageHolder_Impl > OStorageList_Impl;
-
 class SwitchablePersistenceStream;
 struct OStorage_Impl
 {
+    typedef std::list<StorageHolder_Impl> StorageHoldersType;
+
     SotMutexHolderRef           m_rMutexRef;
 
     OStorage*                   m_pAntiImpl;         // only valid if external references exists
-    OStorageList_Impl           m_aReadOnlyWrapList; // only valid if readonly external reference exists
+    StorageHoldersType      m_aReadOnlyWrapList; // only valid if readonly external reference exists
 
     sal_Int32                   m_nStorageMode; // open mode ( read/write/trunc/nocreate )
     bool                    m_bIsModified;  // only modified elements will be sent to the original content
commit 019617d590c559dee2f4fdb3524725f9b70da9d2
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Mon Jun 9 12:38:04 2014 -0400

    Use for_each with boost::checked_deletor for this.
    
    Change-Id: Iea8ef5138bc98e50a196cb38051a199b326c1405

diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index e4e9174..fc538b6 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -53,6 +53,8 @@
 #include "switchpersistencestream.hxx"
 #include "ohierarchyholder.hxx"
 
+#include <boost/checked_delete.hpp>
+
 using namespace ::com::sun::star;
 
 #if OSL_DEBUG_LEVEL > 0
@@ -335,16 +337,10 @@ OStorage_Impl::~OStorage_Impl()
         m_pParent = NULL;
     }
 
-    for ( SotElementList_Impl::iterator pElementIter = m_aChildrenList.begin();
-          pElementIter != m_aChildrenList.end(); ++pElementIter )
-        delete *pElementIter;
-
+    std::for_each(m_aChildrenList.begin(), m_aChildrenList.end(), boost::checked_deleter<SotElement_Impl>());
     m_aChildrenList.clear();
 
-    for ( SotElementList_Impl::iterator pDeletedIter = m_aDeletedList.begin();
-          pDeletedIter != m_aDeletedList.end(); ++pDeletedIter )
-        delete *pDeletedIter;
-
+    std::for_each(m_aDeletedList.begin(), m_aDeletedList.end(), boost::checked_deleter<SotElement_Impl>());
     m_aDeletedList.clear();
 
     if ( m_nStorageType == embed::StorageFormats::OFOPXML && m_pRelStorElement )


More information about the Libreoffice-commits mailing list