From 9734a6e1c3930c29aa3c7b80cb896d57c2bebe31 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 29 Jan 2017 12:28:45 +0200 Subject: GetWasUsed can return by value, no need to be a special snowflake Change-Id: I4ef22fa49ee883ff0bddb49d1711e8521905502f Reviewed-on: https://gerrit.libreoffice.org/33658 Tested-by: Jenkins Reviewed-by: Noel Grandin --- xmloff/source/style/xmlnumfe.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'xmloff/source/style') diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index bb5db1bea964..07e4ac23c126 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -106,7 +106,7 @@ public: bool GetFirstUsed(sal_uInt32& nKey); bool GetNextUsed(sal_uInt32& nKey); - void GetWasUsed(uno::Sequence& rWasUsed); + uno::Sequence GetWasUsed(); void SetWasUsed(const uno::Sequence& rWasUsed); }; @@ -182,10 +182,10 @@ bool SvXMLNumUsedList_Impl::GetNextUsed(sal_uInt32& nKey) return bRet; } -void SvXMLNumUsedList_Impl::GetWasUsed(uno::Sequence& rWasUsed) +uno::Sequence SvXMLNumUsedList_Impl::GetWasUsed() { - rWasUsed.realloc(nWasUsedCount); - sal_Int32* pWasUsed = rWasUsed.getArray(); + uno::Sequence ret(nWasUsedCount); + sal_Int32* pWasUsed = ret.getArray(); if (pWasUsed) { SvXMLuInt32Set::const_iterator aItr = aWasUsed.begin(); @@ -196,6 +196,7 @@ void SvXMLNumUsedList_Impl::GetWasUsed(uno::Sequence& rWasUsed) ++pWasUsed; } } + return ret; } void SvXMLNumUsedList_Impl::SetWasUsed(const uno::Sequence& rWasUsed) @@ -1889,10 +1890,11 @@ void SvXMLNumFmtExport::SetUsed( sal_uInt32 nKey ) } } -void SvXMLNumFmtExport::GetWasUsed(uno::Sequence& rWasUsed) +uno::Sequence SvXMLNumFmtExport::GetWasUsed() { if (pUsedList) - pUsedList->GetWasUsed(rWasUsed); + return pUsedList->GetWasUsed(); + return uno::Sequence(); } void SvXMLNumFmtExport::SetWasUsed(const uno::Sequence& rWasUsed) -- cgit