[Libreoffice-commits] core.git: embeddedobj/source embedserv/source formula/source

Julien Nabet serval2412 at yahoo.fr
Sat Mar 17 17:30:59 UTC 2018


 embeddedobj/source/msole/olecomponent.cxx   |    7 ++-----
 embedserv/source/embed/ed_ioleobject.cxx    |   25 +++++++++----------------
 embedserv/source/embed/ed_ipersiststr.cxx   |    6 +++---
 formula/source/core/api/FormulaCompiler.cxx |    6 +++---
 formula/source/ui/dlg/funcpage.cxx          |   10 +++-------
 5 files changed, 20 insertions(+), 34 deletions(-)

New commits:
commit c6994fb815624d31bc2570bdcdc5991fd1195792
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sat Mar 17 11:59:25 2018 +0100

    Use for-range loops in embeddedobj, embedserv and formula
    
    Change-Id: I56e1bace8ab8312524e681d3865a1a89d523812d
    Reviewed-on: https://gerrit.libreoffice.org/51459
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx
index df3b0131b07b..cd9ac6e142f8 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -462,12 +462,9 @@ OleComponent::~OleComponent()
         } catch( const uno::Exception& ) {}
     }
 
-    for ( FormatEtcList::iterator aIter = m_pNativeImpl->m_aFormatsList.begin();
-          aIter != m_pNativeImpl->m_aFormatsList.end();
-          ++aIter )
+    for (auto const& format : m_pNativeImpl->m_aFormatsList)
     {
-        delete *aIter;
-        (*aIter) = nullptr;
+        delete format;
     }
     m_pNativeImpl->m_aFormatsList.clear();
 
diff --git a/embedserv/source/embed/ed_ioleobject.cxx b/embedserv/source/embed/ed_ioleobject.cxx
index 82a39b8b583a..ed1e734b45ac 100644
--- a/embedserv/source/embed/ed_ioleobject.cxx
+++ b/embedserv/source/embed/ed_ioleobject.cxx
@@ -90,11 +90,10 @@ HRESULT EmbedDocument_Impl::OLENotifyClosing()
 {
     AdviseSinkHashMap aAHM(m_aAdviseHashMap);
 
-    for ( AdviseSinkHashMapIterator iAdvise = aAHM.begin();
-          iAdvise != aAHM.end(); iAdvise++ )
+    for (auto const& advise : aAHM)
     {
-        if ( iAdvise->second )
-            iAdvise->second->OnClose();
+        if (advise.second)
+            advise.second->OnClose();
     }
 
     return S_OK;
@@ -405,12 +404,9 @@ HRESULT EmbedDocument_Impl::SaveObject()
     if(m_pClientSite) {
         hr = m_pClientSite->SaveObject();
 
-        for ( AdviseSinkHashMapIterator iAdvise =
-                  m_aAdviseHashMap.begin();
-              iAdvise != m_aAdviseHashMap.end();
-              iAdvise++ )
-            if ( iAdvise->second )
-                iAdvise->second->OnSave( );
+        for (auto const& advise : m_aAdviseHashMap)
+            if (advise.second)
+                advise.second->OnSave();
     }
     else if ( m_aFileName.getLength() && IsDirty() == S_OK )
     {
@@ -440,12 +436,9 @@ HRESULT EmbedDocument_Impl::ShowObject()
 
 void EmbedDocument_Impl::notify( bool bDataChanged )
 {
-    for ( AdviseSinkHashMapIterator iAdvise =
-              m_aAdviseHashMap.begin();
-          iAdvise != m_aAdviseHashMap.end();
-          iAdvise++ )
-        if ( iAdvise->second )
-            iAdvise->second->OnViewChange( DVASPECT_CONTENT, -1 );
+    for (auto const& advise : m_aAdviseHashMap)
+        if (advise.second)
+            advise.second->OnViewChange( DVASPECT_CONTENT, -1 );
 
     if ( m_pDAdviseHolder && bDataChanged )
         m_pDAdviseHolder->SendOnDataChange( static_cast<IDataObject*>(this), 0, 0 );
diff --git a/embedserv/source/embed/ed_ipersiststr.cxx b/embedserv/source/embed/ed_ipersiststr.cxx
index 3b817ceb3138..632297274451 100644
--- a/embedserv/source/embed/ed_ipersiststr.cxx
+++ b/embedserv/source/embed/ed_ipersiststr.cxx
@@ -702,10 +702,10 @@ STDMETHODIMP EmbedDocument_Impl::SaveCompleted( IStorage *pStgNew )
                                         &m_pExtStream );
     if ( FAILED( hr ) || !m_pExtStream ) return E_OUTOFMEMORY;
 
-    for ( AdviseSinkHashMapIterator iAdvise = m_aAdviseHashMap.begin(); iAdvise != m_aAdviseHashMap.end(); iAdvise++ )
+    for (auto const& advise : m_aAdviseHashMap)
     {
-        if ( iAdvise->second )
-            iAdvise->second->OnSave();
+        if ( advise.second )
+            advise.second->OnSave();
     }
 
     return S_OK;
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 537f8f74f074..d16e08068b94 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -577,11 +577,11 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create
             // If AddIn functions are present in this mapping, use them, and only those.
             if (hasExternals())
             {
-                for (ExternalHashMap::const_iterator it( maExternalHashMap.begin());it != maExternalHashMap.end(); ++it)
+                for (auto const& elem : maExternalHashMap)
                 {
                     FormulaOpCodeMapEntry aEntry;
-                    aEntry.Name = (*it).first;
-                    aEntry.Token.Data <<= (*it).second;
+                    aEntry.Name = elem.first;
+                    aEntry.Token.Data <<= elem.second;
                     aEntry.Token.OpCode = ocExternal;
                     aVec.push_back( aEntry);
                 }
diff --git a/formula/source/ui/dlg/funcpage.cxx b/formula/source/ui/dlg/funcpage.cxx
index 5cbcdf608b6a..6e1ff81e426c 100644
--- a/formula/source/ui/dlg/funcpage.cxx
+++ b/formula/source/ui/dlg/funcpage.cxx
@@ -144,16 +144,12 @@ void FuncPage::UpdateFunctionList(const OUString& aStr)
         }
         else // LRU-List
         {
-            ::std::vector< TFunctionDesc >::iterator aIter = aLRUList.begin();
-            ::std::vector< TFunctionDesc >::iterator aEnd = aLRUList.end();
-
-            for ( ; aIter != aEnd; ++aIter )
+            for (auto const& elem : aLRUList)
             {
-                const IFunctionDescription* pDesc = *aIter;
-                if (pDesc)  // may be null if a function is no longer available
+                if (elem)  // may be null if a function is no longer available
                 {
                     m_pLbFunction->SetEntryData(
-                        m_pLbFunction->InsertEntry( pDesc->getFunctionName() ), const_cast<IFunctionDescription *>(pDesc) );
+                        m_pLbFunction->InsertEntry( elem->getFunctionName() ), const_cast<IFunctionDescription *>(elem) );
                 }
             }
         }


More information about the Libreoffice-commits mailing list