summaryrefslogtreecommitdiff
path: root/svx/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-12-18 14:50:59 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-12-19 07:04:41 +0100
commita064fb2008e69c20595f60b6d55dd9d691e2e9e2 (patch)
tree535a154904566c094d42eb3a4dc3abd9ddc5855c /svx/source
parent6774e3cebf5937f8771cc0f0850696a5154ca283 (diff)
use unique_ptr in RemoveWhichRange
Change-Id: I6c0f07f0dc4a7f6bfa15c0ea720f349894559429 Reviewed-on: https://gerrit.libreoffice.org/65340 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r--svx/source/svdraw/svdedxv.cxx6
-rw-r--r--svx/source/svdraw/svdetc.cxx6
2 files changed, 6 insertions, 6 deletions
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index d2a4cff5710d..be6e6897576a 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -2129,9 +2129,9 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll)
// Otherwise split Set, if necessary.
// Now we build an ItemSet aSet that doesn't contain EE_Items from
// *pSet (otherwise it would be a copy).
- sal_uInt16* pNewWhichTable=RemoveWhichRange(pSet->GetRanges(),EE_ITEMS_START,EE_ITEMS_END);
- SfxItemSet aSet(mpModel->GetItemPool(),pNewWhichTable);
- delete[] pNewWhichTable;
+ std::unique_ptr<sal_uInt16[]> pNewWhichTable=RemoveWhichRange(pSet->GetRanges(),EE_ITEMS_START,EE_ITEMS_END);
+ SfxItemSet aSet(mpModel->GetItemPool(),pNewWhichTable.get());
+ pNewWhichTable.reset();
SfxWhichIter aIter(aSet);
sal_uInt16 nWhich=aIter.FirstWhich();
while (nWhich!=0)
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index 46efe26887d2..3e73c8a282fc 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -377,7 +377,7 @@ bool SearchOutlinerItems(const SfxItemSet& rSet, bool bInklDefaults, bool* pbOnl
return bHas;
}
-sal_uInt16* RemoveWhichRange(const sal_uInt16* pOldWhichTable, sal_uInt16 nRangeBeg, sal_uInt16 nRangeEnd)
+std::unique_ptr<sal_uInt16[]> RemoveWhichRange(const sal_uInt16* pOldWhichTable, sal_uInt16 nRangeBeg, sal_uInt16 nRangeEnd)
{
// Six possible cases (per range):
// [Beg..End] Range, to delete
@@ -403,8 +403,8 @@ sal_uInt16* RemoveWhichRange(const sal_uInt16* pOldWhichTable, sal_uInt16 nRange
else /* nCase=6 */ nAlloc+=2;
}
- sal_uInt16* pNewWhichTable=new sal_uInt16[nAlloc];
- memcpy(pNewWhichTable,pOldWhichTable,nAlloc*sizeof(sal_uInt16));
+ std::unique_ptr<sal_uInt16[]> pNewWhichTable(new sal_uInt16[nAlloc]);
+ memcpy(pNewWhichTable.get(), pOldWhichTable, nAlloc*sizeof(sal_uInt16));
pNewWhichTable[nAlloc-1]=0; // in case 3, there's no 0 at the end.
// now remove the unwanted ranges
nNum=nAlloc-1;