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

Serge Krot Serge.Krot at cib.de
Sat Oct 28 01:31:49 UTC 2017


 sw/source/filter/ww8/wrtw8nds.cxx |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 9a9cfb1d80cea14abddea3d2e18fedb1549c9293
Author: Serge Krot <Serge.Krot at cib.de>
Date:   Thu Oct 26 17:17:03 2017 +0200

    related tdf#38778 Speed-up: Do not traverse the whole array
    
    It is known that text attributes are sorted inside SwpHints.
    No need to check all entries if special position is provided.
    
    Change-Id: Iac92cd40cd6d094d158f3b50fd768f47029ccdce
    Reviewed-on: https://gerrit.libreoffice.org/43911
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index a43db5d01869..de0820b8204a 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -663,10 +663,16 @@ bool SwWW8AttrIter::IsTextAttr( sal_Int32 nSwPos )
         for (size_t i = 0; i < pTextAttrs->Count(); ++i)
         {
             const SwTextAttr* pHt = pTextAttrs->Get(i);
-            if ( ( pHt->HasDummyChar() || pHt->HasContent() )
-                 && (pHt->GetStart() == nSwPos) )
+            if (nSwPos == pHt->GetStart())
             {
-                return true;
+                if (pHt->HasDummyChar() || pHt->HasContent() )
+                {
+                    return true;
+                }
+            }
+            else if (nSwPos < pHt->GetStart())
+            {
+                break; // sorted by start
             }
         }
     }


More information about the Libreoffice-commits mailing list