[Libreoffice-commits] core.git: sw/source

Caolán McNamara caolanm at redhat.com
Tue Feb 24 09:34:27 PST 2015


 sw/source/core/doc/docredln.cxx |   26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

New commits:
commit 28f909df366d731ee0684d0608e5a00dcf70181c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 24 16:13:30 2015 +0000

    Revert "Simplify loops and reduce scope of some variables"
    
    doesn't appear to be equivalent, first continue now skips
    second GetBound assign that original code would have done
    
    This reverts commit b56614c6bc8d32a68099c7841ba4a4076f584057.
    
    Change-Id: I113670064fd285795234ae9c9e09be0cc0697cd0

diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index ba755ab..7342206 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1298,20 +1298,20 @@ void SwRangeRedline::DelCopyOfSection(size_t nMyPos)
                 const SwRedlineTbl& rTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
                 sal_uInt16 n = nMyPos;
                 OSL_ENSURE( n != USHRT_MAX, "How strange. We don't exist!" );
-                while ( n > 0 )
+                for( bool bBreak = false; !bBreak && n > 0; )
                 {
                     --n;
+                    bBreak = true;
                     if( rTbl[ n ]->GetBound(true) == *aPam.GetPoint() )
                     {
                         rTbl[ n ]->GetBound(true) = *pEnd;
-                        continue;
+                        bBreak = false;
                     }
                     if( rTbl[ n ]->GetBound(false) == *aPam.GetPoint() )
                     {
                         rTbl[ n ]->GetBound(false) = *pEnd;
-                        continue;
+                        bBreak = false;
                     }
-                    break;
                 }
 
                 SwPosition aEnd( *pEnd );
@@ -1345,39 +1345,41 @@ void SwRangeRedline::MoveFromSection(size_t nMyPos)
         const SwRedlineTbl& rTbl = pDoc->getIDocumentRedlineAccess().GetRedlineTbl();
         std::vector<SwPosition*> aBeforeArr, aBehindArr;
         OSL_ENSURE( this, "this is not in the array?" );
+        bool bBreak = false;
+        SwRedlineTbl::size_type n;
 
-        for( SwRedlineTbl::size_type n = nMyPos+1; n < rTbl.size(); ++n )
+        for( n = nMyPos+1; !bBreak && n < rTbl.size(); ++n )
         {
+            bBreak = true;
             if( rTbl[ n ]->GetBound(true) == *GetPoint() )
             {
                 SwRangeRedline* pRedl = rTbl[n];
                 aBehindArr.push_back(&pRedl->GetBound(true));
-                continue;
+                bBreak = false;
             }
             if( rTbl[ n ]->GetBound(false) == *GetPoint() )
             {
                 SwRangeRedline* pRedl = rTbl[n];
                 aBehindArr.push_back(&pRedl->GetBound(false));
-                continue;
+                bBreak = false;
             }
-            break;
         }
-        for( SwRedlineTbl::size_type n = nMyPos; n ; )
+        for( bBreak = false, n = nMyPos; !bBreak && n ; )
         {
             --n;
+            bBreak = true;
             if( rTbl[ n ]->GetBound(true) == *GetPoint() )
             {
                 SwRangeRedline* pRedl = rTbl[n];
                 aBeforeArr.push_back(&pRedl->GetBound(true));
-                continue;
+                bBreak = false;
             }
             if( rTbl[ n ]->GetBound(false) == *GetPoint() )
             {
                 SwRangeRedline* pRedl = rTbl[n];
                 aBeforeArr.push_back(&pRedl->GetBound(false));
-                continue;
+                bBreak = false;
             }
-            break;
         }
 
         const SwNode* pKeptCntntSectNode( &pCntntSect->GetNode() ); // #i95711#


More information about the Libreoffice-commits mailing list