ucb/source/core/ucbcmds.cxx | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
New commits: commit 3e397cd3ee1dc2720a380a9945f5d5d295997e9b Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Mon Jul 19 12:18:00 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Jul 19 22:15:04 2021 +0200 no need to allocate Sequence separately in CommandProcessorInfo Change-Id: I325e63f822af1d9a0213837f40e9cc2b3e466c98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119212 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/ucb/source/core/ucbcmds.cxx b/ucb/source/core/ucbcmds.cxx index 685767f6cbf9..7323cd78e94b 100644 --- a/ucb/source/core/ucbcmds.cxx +++ b/ucb/source/core/ucbcmds.cxx @@ -18,6 +18,7 @@ */ #include <memory> +#include <optional> #include <osl/diagnose.h> #include <comphelper/propertysequence.hxx> #include <cppuhelper/implbase.hxx> @@ -193,7 +194,7 @@ uno::Reference< io::XInputStream > SAL_CALL ActiveDataSink::getInputStream() class CommandProcessorInfo : public cppu::WeakImplHelper< ucb::XCommandInfo > { - std::unique_ptr< uno::Sequence< ucb::CommandInfo > > m_pInfo; + std::optional< uno::Sequence< ucb::CommandInfo > > m_xInfo; public: CommandProcessorInfo(); @@ -210,19 +211,19 @@ public: CommandProcessorInfo::CommandProcessorInfo() - : m_pInfo( new uno::Sequence< ucb::CommandInfo >( 3 ) ) + : m_xInfo( 3 ) { - (*m_pInfo)[ 0 ] + (*m_xInfo)[ 0 ] = ucb::CommandInfo( GETCOMMANDINFO_NAME, // Name GETCOMMANDINFO_HANDLE, // Handle cppu::UnoType<void>::get() ); // ArgType - (*m_pInfo)[ 1 ] + (*m_xInfo)[ 1 ] = ucb::CommandInfo( GLOBALTRANSFER_NAME, // Name GLOBALTRANSFER_HANDLE, // Handle cppu::UnoType<ucb::GlobalTransferCommandArgument>::get() ); // ArgType - (*m_pInfo)[ 2 ] + (*m_xInfo)[ 2 ] = ucb::CommandInfo( CHECKIN_NAME, // Name CHECKIN_HANDLE, // Handle @@ -234,7 +235,7 @@ CommandProcessorInfo::CommandProcessorInfo() uno::Sequence< ucb::CommandInfo > SAL_CALL CommandProcessorInfo::getCommands() { - return *m_pInfo; + return *m_xInfo; } @@ -242,9 +243,9 @@ CommandProcessorInfo::getCommands() ucb::CommandInfo SAL_CALL CommandProcessorInfo::getCommandInfoByName( const OUString& Name ) { - auto pInfo = std::find_if(m_pInfo->begin(), m_pInfo->end(), + auto pInfo = std::find_if(m_xInfo->begin(), m_xInfo->end(), [&Name](const ucb::CommandInfo& rInfo) { return rInfo.Name == Name; }); - if (pInfo != m_pInfo->end()) + if (pInfo != m_xInfo->end()) return *pInfo; throw ucb::UnsupportedCommandException(); @@ -255,9 +256,9 @@ CommandProcessorInfo::getCommandInfoByName( const OUString& Name ) ucb::CommandInfo SAL_CALL CommandProcessorInfo::getCommandInfoByHandle( sal_Int32 Handle ) { - auto pInfo = std::find_if(m_pInfo->begin(), m_pInfo->end(), + auto pInfo = std::find_if(m_xInfo->begin(), m_xInfo->end(), [&Handle](const ucb::CommandInfo& rInfo) { return rInfo.Handle == Handle; }); - if (pInfo != m_pInfo->end()) + if (pInfo != m_xInfo->end()) return *pInfo; throw ucb::UnsupportedCommandException(); @@ -268,7 +269,7 @@ CommandProcessorInfo::getCommandInfoByHandle( sal_Int32 Handle ) sal_Bool SAL_CALL CommandProcessorInfo::hasCommandByName( const OUString& Name ) { - return std::any_of(m_pInfo->begin(), m_pInfo->end(), + return std::any_of(m_xInfo->begin(), m_xInfo->end(), [&Name](const ucb::CommandInfo& rInfo) { return rInfo.Name == Name; }); } @@ -276,7 +277,7 @@ sal_Bool SAL_CALL CommandProcessorInfo::hasCommandByName( // virtual sal_Bool SAL_CALL CommandProcessorInfo::hasCommandByHandle( sal_Int32 Handle ) { - return std::any_of(m_pInfo->begin(), m_pInfo->end(), + return std::any_of(m_xInfo->begin(), m_xInfo->end(), [&Handle](const ucb::CommandInfo& rInfo) { return rInfo.Handle == Handle; }); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits