diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2013-08-25 01:50:22 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-08-25 15:14:17 +0000 |
commit | a3d10e95d24d9199de60b05e2ce4207f57988021 (patch) | |
tree | 7a204b4ed9670c8c6ca95edc091d5b437edfa4ea | |
parent | e19804aabac1e6beae444bc9d8918b8fc78868cd (diff) |
vector<OUString*> to vector<OUString> as a temporary
Change-Id: Ib615c88c0ca9c0a3d969860249e96cb71b75f6f7
Reviewed-on: https://gerrit.libreoffice.org/5623
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/source/core/unocore/unofield.cxx | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index db9e2a34a3d3..57cb5bcf160b 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; |