sc/source/core/data/documen8.cxx |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

New commits:
commit aff52ed56af99c4f1fcf20efd6303d7653f39233
Author:     buldi <dobrakowskira...@gmail.com>
AuthorDate: Fri Apr 21 01:46:51 2023 +0200
Commit:     Hossein <hoss...@libreoffice.org>
CommitDate: Mon Jun 12 10:29:39 2023 +0200

    tdf#145538 Refactor to use range-based for-loop
    
    Change-Id: Idc64cae6deccbf62824eadef3a3b4dbb979cfd39
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150737
    Tested-by: Jenkins
    Reviewed-by: Hossein <hoss...@libreoffice.org>

diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 18f8115f7a73..1c97e5d2408a 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -911,12 +911,10 @@ ScDdeLink* lclGetDdeLink(
     if( pLinkManager )
     {
         const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
-        size_t nCount = rLinks.size();
         if( pnDdePos ) *pnDdePos = 0;
-        for( size_t nIndex = 0; nIndex < nCount; ++nIndex )
+        for( const auto& nLinks : rLinks )
         {
-            ::sfx2::SvBaseLink* pLink = rLinks[ nIndex ].get();
-            if( ScDdeLink* pDdeLink = dynamic_cast<ScDdeLink*>( pLink )  )
+            if( ScDdeLink* pDdeLink = dynamic_cast<ScDdeLink*>( nLinks.get() ) 
 )
             {
                 if( (pDdeLink->GetAppl() == rAppl) &&
                     (pDdeLink->GetTopic() == rTopic) &&
@@ -937,13 +935,10 @@ ScDdeLink* lclGetDdeLink( const sfx2::LinkManager* 
pLinkManager, size_t nDdePos
 {
     if( pLinkManager )
     {
-        const ::sfx2::SvBaseLinks& rLinks = pLinkManager->GetLinks();
-        size_t nCount = rLinks.size();
         size_t nDdeIndex = 0;       // counts only the DDE links
-        for( size_t nIndex = 0; nIndex < nCount; ++nIndex )
+        for( const auto& pLink : pLinkManager->GetLinks() )
         {
-            ::sfx2::SvBaseLink* pLink = rLinks[ nIndex ].get();
-            if( ScDdeLink* pDdeLink = dynamic_cast<ScDdeLink*>( pLink )  )
+            if( ScDdeLink* pDdeLink = dynamic_cast<ScDdeLink*>( pLink.get() )  
)
             {
                 if( nDdeIndex == nDdePos )
                     return pDdeLink;

Reply via email to