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

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 21 18:30:50 UTC 2020


 sw/source/filter/ww8/wrtw8nds.cxx |   20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

New commits:
commit a663bcda493b7d412e3837a4df38ca3d015a6ec5
Author:     Justin Luth <justin.luth at collabora.com>
AuthorDate: Fri Aug 7 14:28:07 2020 +0300
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Fri Aug 21 20:30:11 2020 +0200

    NFC sw MS export: flatten useless aTmpFlyIter loop
    
    The loop did nothing, since aTmpFlyIter was never used.
    IsAnchorLinkedToThisNode() is only called in one place
    to test whether to bPostponeWritingText.
    
    One option would have been to actually use aTmpFlyIter
    instead of maFlyIter, which would seem to make the most sense,
    and was likely @synerzip's original intention.
    (And in that case, it should return false as soon as
    nNodePos < nAnchorPos since this is a sorted list.)
    
    However, this whole concept of PostponeWritingText is ripe
    for regressions etc. I don't want to introduce an even
    larger number of postponed cases, so instead I chose to do
    option two, which is to just re-write the function in the
    way that it actually operated. So this is supposed to
    be in a No-Functional-Change cleanup.
    
    Change-Id: I227e2ecd2aca82b03b54ae3924db91933ca2c930
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100374
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index e9a830d55ce4..9817e562e379 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -610,21 +610,13 @@ bool SwWW8AttrIter::IsWatermarkFrame()
 
 bool SwWW8AttrIter::IsAnchorLinkedToThisNode( sal_uLong nNodePos )
 {
-    ww8::FrameIter aTmpFlyIter = maFlyIter ;
-
-    while ( aTmpFlyIter != maFlyFrames.end() )
-    {
-        const SwPosition &rAnchor  = maFlyIter->GetPosition();
-        sal_uLong nAnchorPos = rAnchor.nNode.GetIndex();
-        /* if current node position and the anchor position are the same
-           then the frame anchor is linked to this node
-        */
-        if ( nAnchorPos == nNodePos )
-            return true ;
+    if ( maFlyIter == maFlyFrames.end() )
+        return false;
 
-        ++aTmpFlyIter;
-    }
-    return false ;
+    /* if current node position and the anchor position are the same
+        then the frame anchor is linked to this node
+    */
+    return nNodePos == maFlyIter->GetPosition().nNode.GetIndex();
 }
 
 bool SwWW8AttrIter::HasFlysAt(sal_Int32 nSwPos) const


More information about the Libreoffice-commits mailing list