diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-19 12:14:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-07-19 18:42:19 +0200 |
commit | 09394e0d6987345f30b316ff44cf007199ec8f09 (patch) | |
tree | 3d7bcdb4c942fcc43aa93efcef2f5b88893cbc86 /ucb | |
parent | 37259db1518135af5f85171e0c9c1b1d5475970e (diff) |
no need to allocate Sequence separately in CCRS_Cache
Change-Id: Ia433c56f512f70f92926de851363d95071a760f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119210
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucb')
-rw-r--r-- | ucb/source/cacher/cachedcontentresultset.cxx | 12 | ||||
-rw-r--r-- | ucb/source/cacher/cachedcontentresultset.hxx | 5 |
2 files changed, 9 insertions, 8 deletions
diff --git a/ucb/source/cacher/cachedcontentresultset.cxx b/ucb/source/cacher/cachedcontentresultset.cxx index 40a34fadda86..68ef19d627e6 100644 --- a/ucb/source/cacher/cachedcontentresultset.cxx +++ b/ucb/source/cacher/cachedcontentresultset.cxx @@ -224,9 +224,9 @@ void CachedContentResultSet::CCRS_Cache sal_Int32 nDiff = nRow - m_pResult->StartIndex; if( nDiff < 0 ) nDiff *= -1; - Sequence< sal_Bool >* pMappedReminder = getMappedReminder(); - if( nDiff < pMappedReminder->getLength() ) - (*pMappedReminder)[nDiff] = true; + Sequence< sal_Bool >& rMappedReminder = getMappedReminder(); + if( nDiff < rMappedReminder.getLength() ) + rMappedReminder[nDiff] = true; } bool CachedContentResultSet::CCRS_Cache @@ -242,16 +242,16 @@ bool CachedContentResultSet::CCRS_Cache return false; } -Sequence< sal_Bool >* CachedContentResultSet::CCRS_Cache +Sequence< sal_Bool >& CachedContentResultSet::CCRS_Cache ::getMappedReminder() { if( !m_pMappedReminder ) { sal_Int32 nCount = m_pResult->Rows.getLength(); - m_pMappedReminder.reset(new Sequence< sal_Bool >( nCount )); + m_pMappedReminder.emplace( nCount ); std::fill(m_pMappedReminder->begin(), m_pMappedReminder->end(), false); } - return m_pMappedReminder.get(); + return *m_pMappedReminder; } const Any& CachedContentResultSet::CCRS_Cache diff --git a/ucb/source/cacher/cachedcontentresultset.hxx b/ucb/source/cacher/cachedcontentresultset.hxx index 99867a074894..3c20996b115f 100644 --- a/ucb/source/cacher/cachedcontentresultset.hxx +++ b/ucb/source/cacher/cachedcontentresultset.hxx @@ -34,6 +34,7 @@ #include <rtl/ref.hxx> #include <memory> +#include <optional> namespace com::sun::star::script { class XTypeConverter; @@ -54,7 +55,7 @@ class CachedContentResultSet m_pResult; css::uno::Reference< css::ucb::XContentIdentifierMapping > m_xContentIdentifierMapping; - std::unique_ptr<css::uno::Sequence< sal_Bool >> m_pMappedReminder; + std::optional<css::uno::Sequence< sal_Bool >> m_pMappedReminder; private: /// @throws css::sdbc::SQLException @@ -67,7 +68,7 @@ class CachedContentResultSet void remindMapped( sal_Int32 nRow ); bool isRowMapped( sal_Int32 nRow ); - css::uno::Sequence< sal_Bool >* getMappedReminder(); + css::uno::Sequence< sal_Bool >& getMappedReminder(); public: CCRS_Cache( const css::uno::Reference< |