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

Jochen Nitschke j.nitschke+logerrit at ok.de
Tue Sep 13 13:10:28 UTC 2016


 editeng/source/accessibility/AccessibleEditableTextPara.cxx |   62 ++++--------
 1 file changed, 25 insertions(+), 37 deletions(-)

New commits:
commit 7aa10d2be124386928314160c4d81dd7978c7494
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Tue Sep 13 01:26:03 2016 +0200

    fix out of bounds error
    
    there are 22 entries, but Sequence was allocated with 21 fields
    
    Change-Id: I6af71e2ece99b643843b4d82e0c6be332be361fa
    Reviewed-on: https://gerrit.libreoffice.org/28852
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index 709a229..0faf064 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -831,43 +831,31 @@ namespace accessibility
 
     static uno::Sequence< OUString > const & getAttributeNames()
     {
-        static uno::Sequence< OUString >* pNames = nullptr;
-
-        if( pNames == nullptr )
-        {
-            uno::Sequence< OUString >* pSeq = new uno::Sequence< OUString >( 21 );
-            OUString* pStrings = pSeq->getArray();
-            sal_Int32 i = 0;
-            #define STR(x) pStrings[i++] = x
-            STR("CharColor");
-            STR("CharContoured");
-            STR("CharEmphasis");
-            STR("CharEscapement");
-            STR("CharFontName");
-            STR("CharHeight");
-            STR("CharPosture");
-            STR("CharShadowed");
-            STR("CharStrikeout");
-            STR("CharCaseMap");
-            STR("CharUnderline");
-            STR("CharUnderlineColor");
-            STR("CharWeight");
-            STR("NumberingLevel");
-            STR("NumberingRules");
-            STR("ParaAdjust");
-            STR("ParaBottomMargin");
-            STR("ParaFirstLineIndent");
-            STR("ParaLeftMargin");
-            STR("ParaLineSpacing");
-            STR("ParaRightMargin");
-            STR("ParaTabStops");
-            #undef STR
-            DBG_ASSERT( i == pSeq->getLength(), "Please adjust length" );
-            if( i != pSeq->getLength() )
-                pSeq->realloc( i );
-            pNames = pSeq;
-        }
-        return *pNames;
+        static const uno::Sequence<OUString> aNames{
+            "CharColor",
+            "CharContoured",
+            "CharEmphasis",
+            "CharEscapement",
+            "CharFontName",
+            "CharHeight",
+            "CharPosture",
+            "CharShadowed",
+            "CharStrikeout",
+            "CharCaseMap",
+            "CharUnderline",
+            "CharUnderlineColor",
+            "CharWeight",
+            "NumberingLevel",
+            "NumberingRules",
+            "ParaAdjust",
+            "ParaBottomMargin",
+            "ParaFirstLineIndent",
+            "ParaLeftMargin",
+            "ParaLineSpacing",
+            "ParaRightMargin",
+            "ParaTabStops"};
+
+        return aNames;
     }
 
     struct IndexCompare


More information about the Libreoffice-commits mailing list