diff options
Diffstat (limited to 'package')
-rw-r--r-- | package/source/xstor/xstorage.cxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 0403f2b0f464..a5777deb771e 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1461,17 +1461,24 @@ uno::Sequence< OUString > OStorage_Impl::GetElementNames() ReadContents(); - std::vector< OUString > aElementNames; - aElementNames.reserve( m_aChildrenMap.size() ); + sal_Int32 nCnt = 0; + for ( const auto& pair : m_aChildrenMap ) + for (auto pElement : pair.second) + { + if ( !pElement->m_bIsRemoved ) + nCnt++; + } + uno::Sequence<OUString> aElementNames(nCnt); + OUString* pArray = aElementNames.getArray(); for ( const auto& pair : m_aChildrenMap ) for (auto pElement : pair.second) { if ( !pElement->m_bIsRemoved ) - aElementNames.push_back(pair.first); + *pArray++ = pair.first; } - return comphelper::containerToSequence(aElementNames); + return aElementNames; } void OStorage_Impl::RemoveElement( OUString const & rName, SotElement_Impl* pElement ) |