summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-08-23 09:25:00 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-23 12:30:43 +0200
commitb640c566908de902c26bf209c79c7c3efa4a0def (patch)
tree6d1768cbc779316f98daeb4e12796c32d377a7e8 /sw
parente854848cc7b3ca484cb749ad2f92b203764e8b18 (diff)
loplugin:useuniqueptr in SwXMeta
Change-Id: I10c75fd2cd7b78195661b499753a2fbb90e8793c Reviewed-on: https://gerrit.libreoffice.org/59485 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/inc/unometa.hxx4
-rw-r--r--sw/source/core/unocore/unorefmk.cxx16
2 files changed, 10 insertions, 10 deletions
diff --git a/sw/source/core/inc/unometa.hxx b/sw/source/core/inc/unometa.hxx
index ff6188a6d078..87c351b5dcc4 100644
--- a/sw/source/core/inc/unometa.hxx
+++ b/sw/source/core/inc/unometa.hxx
@@ -84,7 +84,7 @@ protected:
/// @param pDoc and pMeta != 0, but not & because of ImplInheritanceHelper
SwXMeta(SwDoc *const pDoc, ::sw::Meta *const pMeta,
css::uno::Reference< css::text::XText> const& xParentText,
- TextRangeList_t const*const pPortions);
+ std::unique_ptr<TextRangeList_t const> pPortions);
SwXMeta(SwDoc *const pDoc);
@@ -205,7 +205,7 @@ private:
SwXMetaField(SwDoc *const pDoc, ::sw::Meta *const pMeta,
css::uno::Reference< css::text::XText> const& xParentText,
- TextRangeList_t const*const pPortions);
+ std::unique_ptr<TextRangeList_t const> pPortions);
friend css::uno::Reference<css::rdf::XMetadatable>
SwXMeta::CreateXMeta(SwDoc &, bool);
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 86cabc326f5b..12608d77cb15 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -627,9 +627,9 @@ public:
Impl(SwXMeta& rThis, SwDoc& rDoc,
::sw::Meta* const pMeta,
uno::Reference<text::XText> const& xParentText,
- TextRangeList_t const * const pPortions)
+ std::unique_ptr<TextRangeList_t const> pPortions)
: m_EventListeners(m_Mutex)
- , m_pTextPortions(pPortions)
+ , m_pTextPortions(std::move(pPortions))
, m_bIsDisposed(false)
, m_bIsDescriptor(nullptr == pMeta)
, m_xParentText(xParentText)
@@ -678,8 +678,8 @@ uno::Reference<text::XText> const & SwXMeta::GetParentText() const
SwXMeta::SwXMeta(SwDoc *const pDoc, ::sw::Meta *const pMeta,
uno::Reference<text::XText> const& xParentText,
- TextRangeList_t const*const pPortions)
- : m_pImpl( new SwXMeta::Impl(*this, *pDoc, pMeta, xParentText, pPortions) )
+ std::unique_ptr<TextRangeList_t const> pPortions)
+ : m_pImpl( new SwXMeta::Impl(*this, *pDoc, pMeta, xParentText, std::move(pPortions)) )
{
}
@@ -750,9 +750,9 @@ SwXMeta::CreateXMeta(::sw::Meta & rMeta,
if (!xParentText.is()) { return nullptr; }
SwXMeta *const pXMeta( (RES_TXTATR_META == rMeta.GetFormatMeta()->Which())
? new SwXMeta (pTextNode->GetDoc(), &rMeta, xParentText,
- pPortions.release()) // temporarily un-unique_ptr :-(
+ std::move(pPortions))
: new SwXMetaField(pTextNode->GetDoc(), &rMeta, xParentText,
- pPortions.release()));
+ std::move(pPortions)));
// this is why the constructor is private: need to acquire pXMeta here
xMeta.set(pXMeta);
// in order to initialize the weak pointer cache in the core object
@@ -1257,8 +1257,8 @@ inline const ::sw::MetaField* SwXMeta::Impl::GetMetaField() const
SwXMetaField::SwXMetaField(SwDoc *const pDoc, ::sw::Meta *const pMeta,
uno::Reference<text::XText> const& xParentText,
- TextRangeList_t const*const pPortions)
- : SwXMetaField_Base(pDoc, pMeta, xParentText, pPortions)
+ std::unique_ptr<TextRangeList_t const> pPortions)
+ : SwXMetaField_Base(pDoc, pMeta, xParentText, std::move(pPortions))
{
OSL_ENSURE(dynamic_cast< ::sw::MetaField* >(pMeta),
"SwXMetaField created for wrong hint!");