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

Matteo Casalin matteo.casalin at yahoo.com
Sun Aug 25 08:14:40 PDT 2013


 sw/source/core/unocore/unofield.cxx |   22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

New commits:
commit a3d10e95d24d9199de60b05e2ce4207f57988021
Author: Matteo Casalin <matteo.casalin at yahoo.com>
Date:   Sun Aug 25 01:50:22 2013 +0200

    vector<OUString*> to vector<OUString> as a temporary
    
    Change-Id: Ib615c88c0ca9c0a3d969860249e96cb71b75f6f7
    Reviewed-on: https://gerrit.libreoffice.org/5623
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index db9e2a3..57cb5bc 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -2700,29 +2700,25 @@ uno::Sequence< OUString > SwXTextFieldMasters::getElementNames(void)
         throw uno::RuntimeException();
 
     const SwFldTypes* pFldTypes = GetDoc()->GetFldTypes();
-    sal_uInt16 nCount = pFldTypes->size();
-
-    std::vector<OUString*> aFldNames;
-    OUString* pString = new OUString();
+    const size_t nCount = pFldTypes->size();
 
-    for( sal_uInt16 i = 0; i < nCount; i++)
+    std::vector<OUString> aFldNames;
+    for( size_t i = 0; i < nCount; ++i )
     {
         SwFieldType& rFldType = *((*pFldTypes)[i]);
 
-        if (SwXTextFieldMasters::getInstanceName(rFldType, *pString))
+        OUString sFldName;
+        if (SwXTextFieldMasters::getInstanceName(rFldType, sFldName))
         {
-            aFldNames.push_back(pString);
-            pString = new OUString();
+            aFldNames.push_back(sFldName);
         }
     }
-    delete pString;
 
-    uno::Sequence< OUString > aSeq( static_cast<sal_uInt16>(aFldNames.size()) );
+    uno::Sequence< OUString > aSeq( static_cast<sal_Int32>(aFldNames.size()) );
     OUString* pArray = aSeq.getArray();
-    for(sal_uInt16 i = 0; i < aFldNames.size();i++)
+    for (size_t i = 0; i<aFldNames.size(); ++i)
     {
-        pArray[i] = *aFldNames[i];
-        delete aFldNames[i];
+        pArray[i] = aFldNames[i];
     }
 
     return aSeq;


More information about the Libreoffice-commits mailing list