ucbhelper/source/provider/contentinfo.cxx | 22 ++++++++++------------ ucbhelper/source/provider/contentinfo.hxx | 5 ++--- 2 files changed, 12 insertions(+), 15 deletions(-)
New commits: commit 6c294343edc283aed0af392c09779fee572c0c4c Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Jul 19 12:27:41 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jul 20 14:52:04 2021 +0200 no need to allocate Sequence separately in CommandProcessorInfo Change-Id: I7f423dbbe9d7251a99397f1293239333fe7b0cee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119216 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/ucbhelper/source/provider/contentinfo.cxx b/ucbhelper/source/provider/contentinfo.cxx index 394d8d01a8dd..c8f5da5aaa79 100644 --- a/ucbhelper/source/provider/contentinfo.cxx +++ b/ucbhelper/source/provider/contentinfo.cxx @@ -196,10 +196,10 @@ CommandProcessorInfo::~CommandProcessorInfo() uno::Sequence< css::ucb::CommandInfo > SAL_CALL CommandProcessorInfo::getCommands() { - if ( !m_pCommands ) + if ( !m_xCommands ) { osl::MutexGuard aGuard( m_aMutex ); - if ( !m_pCommands ) + if ( !m_xCommands ) { // Get info for commands. @@ -207,9 +207,7 @@ CommandProcessorInfo::getCommands() try { - uno::Sequence< css::ucb::CommandInfo > aCmds - = m_pContent->getCommands( m_xEnv ); - m_pCommands.reset(new uno::Sequence< css::ucb::CommandInfo >( aCmds )); + m_xCommands = m_pContent->getCommands( m_xEnv ); } catch ( uno::RuntimeException const & ) { @@ -217,11 +215,11 @@ CommandProcessorInfo::getCommands() } catch ( uno::Exception const & ) { - m_pCommands.reset(new uno::Sequence< css::ucb::CommandInfo >( 0 )); + m_xCommands.emplace(); } } } - return *m_pCommands; + return *m_xCommands; } @@ -273,7 +271,7 @@ sal_Bool SAL_CALL CommandProcessorInfo::hasCommandByHandle( sal_Int32 Handle ) void CommandProcessorInfo::reset() { osl::MutexGuard aGuard( m_aMutex ); - m_pCommands.reset(); + m_xCommands.reset(); } @@ -286,8 +284,8 @@ bool CommandProcessorInfo::queryCommand( getCommands(); const css::ucb::CommandInfo* pCommands - = m_pCommands->getConstArray(); - sal_Int32 nCount = m_pCommands->getLength(); + = m_xCommands->getConstArray(); + sal_Int32 nCount = m_xCommands->getLength(); for ( sal_Int32 n = 0; n < nCount; ++n ) { const css::ucb::CommandInfo& rCurrCommand = pCommands[ n ]; @@ -310,8 +308,8 @@ bool CommandProcessorInfo::queryCommand( getCommands(); - const css::ucb::CommandInfo* pCommands = m_pCommands->getConstArray(); - sal_Int32 nCount = m_pCommands->getLength(); + const css::ucb::CommandInfo* pCommands = m_xCommands->getConstArray(); + sal_Int32 nCount = m_xCommands->getLength(); for ( sal_Int32 n = 0; n < nCount; ++n ) { const css::ucb::CommandInfo& rCurrCommand = pCommands[ n ]; diff --git a/ucbhelper/source/provider/contentinfo.hxx b/ucbhelper/source/provider/contentinfo.hxx index 09e43c782453..6554c7fcfe66 100644 --- a/ucbhelper/source/provider/contentinfo.hxx +++ b/ucbhelper/source/provider/contentinfo.hxx @@ -20,7 +20,6 @@ #ifndef UCBHELPER_SOURCE_PROVIDER_CONTENTINFO_HXX #define UCBHELPER_SOURCE_PROVIDER_CONTENTINFO_HXX -#include <memory> #include <optional> #include <com/sun/star/ucb/XCommandInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> @@ -89,8 +88,8 @@ class CommandProcessorInfo : { css::uno::Reference< css::ucb::XCommandEnvironment > m_xEnv; - std::unique_ptr<css::uno::Sequence< css::ucb::CommandInfo >> - m_pCommands; + std::optional<css::uno::Sequence< css::ucb::CommandInfo >> + m_xCommands; osl::Mutex m_aMutex; ContentImplHelper* m_pContent; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits