[Libreoffice-commits] core.git: include/toolkit toolkit/source

Noel Grandin noelgrandin at gmail.com
Mon Apr 4 09:16:55 UTC 2016


 include/toolkit/controls/eventcontainer.hxx |    2 +-
 toolkit/source/controls/eventcontainer.cxx  |   18 ++++++++----------
 2 files changed, 9 insertions(+), 11 deletions(-)

New commits:
commit fd4b1fb453c11f8789674afc324d04ac9fb7be67
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Sun Apr 3 17:11:42 2016 +0200

    sequence->vector in toolkit
    
    Change-Id: Ia042eea672bb7535192132ae0b133d1745dc8cde
    Reviewed-on: https://gerrit.libreoffice.org/23759
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/include/toolkit/controls/eventcontainer.hxx b/include/toolkit/controls/eventcontainer.hxx
index 7590e57..acc74cb 100644
--- a/include/toolkit/controls/eventcontainer.hxx
+++ b/include/toolkit/controls/eventcontainer.hxx
@@ -50,7 +50,7 @@ class NameContainer_Impl : public NameContainerHelper
 {
     NameContainerNameMap mHashMap;
     css::uno::Sequence< OUString > mNames;
-    css::uno::Sequence< css::uno::Any > mValues;
+    std::vector< css::uno::Any > mValues;
     sal_Int32 mnElementCount;
     css::uno::Type mType;
 
diff --git a/toolkit/source/controls/eventcontainer.cxx b/toolkit/source/controls/eventcontainer.cxx
index 64c7d8a..8b495da 100644
--- a/toolkit/source/controls/eventcontainer.cxx
+++ b/toolkit/source/controls/eventcontainer.cxx
@@ -64,7 +64,7 @@ Any NameContainer_Impl::getByName( const OUString& aName )
         throw NoSuchElementException();
     }
     sal_Int32 iHashResult = (*aIt).second;
-    Any aRetAny = mValues.getConstArray()[ iHashResult ];
+    Any aRetAny = mValues[ iHashResult ];
     return aRetAny;
 }
 
@@ -97,8 +97,8 @@ void NameContainer_Impl::replaceByName( const OUString& aName, const Any& aEleme
         throw NoSuchElementException();
     }
     sal_Int32 iHashResult = (*aIt).second;
-    Any aOldElement = mValues.getConstArray()[ iHashResult ];
-    mValues.getArray()[ iHashResult ] = aElement;
+    Any aOldElement = mValues[ iHashResult ];
+    mValues[ iHashResult ] = aElement;
 
     // Fire event
     ContainerEvent aEvent;
@@ -126,9 +126,9 @@ void NameContainer_Impl::insertByName( const OUString& aName, const Any& aElemen
 
     sal_Int32 nCount = mNames.getLength();
     mNames.realloc( nCount + 1 );
-    mValues.realloc( nCount + 1 );
+    mValues.resize( nCount + 1 );
     mNames.getArray()[ nCount ] = aName;
-    mValues.getArray()[ nCount ] = aElement;
+    mValues[ nCount ] = aElement;
     mHashMap[ aName ] = nCount;
 
     // Fire event
@@ -149,7 +149,7 @@ void NameContainer_Impl::removeByName( const OUString& Name )
     }
 
     sal_Int32 iHashResult = (*aIt).second;
-    Any aOldElement = mValues.getConstArray()[ iHashResult ];
+    Any aOldElement = mValues[ iHashResult ];
 
     // Fire event
     ContainerEvent aEvent;
@@ -163,14 +163,12 @@ void NameContainer_Impl::removeByName( const OUString& Name )
     if( iLast != iHashResult )
     {
         OUString* pNames = mNames.getArray();
-        Any* pValues = mValues.getArray();
         pNames[ iHashResult ] = pNames[ iLast ];
-        pValues[ iHashResult ] = pValues[ iLast ];
+        mValues[ iHashResult ] = mValues[ iLast ];
         mHashMap[ pNames[ iHashResult ] ] = iHashResult;
     }
     mNames.realloc( iLast );
-    mValues.realloc( iLast );
-
+    mValues.resize( iLast );
 }
 
 // Methods XContainer


More information about the Libreoffice-commits mailing list