[Libreoffice-commits] core.git: ucb/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jul 20 07:27:03 UTC 2021
ucb/source/ucp/tdoc/tdoc_datasupplier.cxx | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
New commits:
commit 59f2d8be6d43a57049db6ea3e425d49b5a3794e8
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 19 12:20:04 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 20 09:26:26 2021 +0200
no need to allocate Sequence separately in DataSupplier_Impl
Change-Id: Ibc66a88472051621262de87458f04b138a76d54f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119213
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx b/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx
index c7bad1e70ffa..6272d9c1420c 100644
--- a/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx
@@ -24,6 +24,7 @@
*************************************************************************/
+#include <optional>
#include <vector>
#include <com/sun/star/ucb/IllegalIdentifierException.hpp>
@@ -66,7 +67,7 @@ struct DataSupplier_Impl
std::vector< ResultListEntry > m_aResults;
rtl::Reference< Content > m_xContent;
uno::Reference< uno::XComponentContext > m_xContext;
- std::unique_ptr<uno::Sequence< OUString > > m_pNamesOfChildren;
+ std::optional<uno::Sequence< OUString > > m_xNamesOfChildren;
bool m_bCountFinal;
bool m_bThrowException;
@@ -207,11 +208,11 @@ bool ResultSetDataSupplier::getResult( sal_uInt32 nIndex )
{
for ( sal_uInt32 n = nOldCount;
n < sal::static_int_cast<sal_uInt32>(
- m_pImpl->m_pNamesOfChildren->getLength());
+ m_pImpl->m_xNamesOfChildren->getLength());
++n )
{
const OUString & rName
- = m_pImpl->m_pNamesOfChildren->getConstArray()[ n ];
+ = m_pImpl->m_xNamesOfChildren->getConstArray()[ n ];
if ( rName.isEmpty() )
{
@@ -266,11 +267,11 @@ sal_uInt32 ResultSetDataSupplier::totalCount()
{
for ( sal_uInt32 n = nOldCount;
n < sal::static_int_cast<sal_uInt32>(
- m_pImpl->m_pNamesOfChildren->getLength());
+ m_pImpl->m_xNamesOfChildren->getLength());
++n )
{
const OUString & rName
- = m_pImpl->m_pNamesOfChildren->getConstArray()[ n ];
+ = m_pImpl->m_xNamesOfChildren->getConstArray()[ n ];
if ( rName.isEmpty() )
{
@@ -369,14 +370,13 @@ bool ResultSetDataSupplier::queryNamesOfChildren()
{
osl::Guard< osl::Mutex > aGuard( m_pImpl->m_aMutex );
- if ( m_pImpl->m_pNamesOfChildren == nullptr )
+ if ( !m_pImpl->m_xNamesOfChildren )
{
- std::unique_ptr<uno::Sequence< OUString >> pNamesOfChildren(
- new uno::Sequence< OUString >() );
+ uno::Sequence< OUString > aNamesOfChildren;
if ( !m_pImpl->m_xContent->getContentProvider()->queryNamesOfChildren(
m_pImpl->m_xContent->getIdentifier()->getContentIdentifier(),
- *pNamesOfChildren ) )
+ aNamesOfChildren ) )
{
OSL_FAIL( "Got no list of children!" );
m_pImpl->m_bThrowException = true;
@@ -384,7 +384,7 @@ bool ResultSetDataSupplier::queryNamesOfChildren()
}
else
{
- m_pImpl->m_pNamesOfChildren = std::move( pNamesOfChildren );
+ m_pImpl->m_xNamesOfChildren = std::move( aNamesOfChildren );
}
}
return true;
More information about the Libreoffice-commits
mailing list