summaryrefslogtreecommitdiff
path: root/svx/source/dialog/svxruler.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-07-10 13:57:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-11 16:01:28 +0200
commit673347af7d37f6789855c17732c9980d91ec6240 (patch)
tree4447a73900c50db2f949755eca64a91ac2d9a385 /svx/source/dialog/svxruler.cxx
parent0bc97adb82f14d6ec22f868422cbfe000afec402 (diff)
loplugin:useuniqueptr in scaddins..svx
Change-Id: I309f98f6b820103a926e9fe94d67d0aff6eb6476 Reviewed-on: https://gerrit.libreoffice.org/39754 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source/dialog/svxruler.cxx')
-rw-r--r--svx/source/dialog/svxruler.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx
index 6c17a9c448c1..5beb625cb0a4 100644
--- a/svx/source/dialog/svxruler.cxx
+++ b/svx/source/dialog/svxruler.cxx
@@ -39,6 +39,7 @@
#include <svx/svdtrans.hxx>
#include "rlrcitem.hxx"
+#include <memory>
#ifndef RULER_TAB_RTL
#define RULER_TAB_RTL ((sal_uInt16)0x0010)
@@ -115,8 +116,8 @@ void RulerDebugWindow::AddDebugText(const sal_Char* pDescription, const OUSt
#endif
struct SvxRuler_Impl {
- sal_uInt16 *pPercBuf;
- sal_uInt16 *pBlockBuf;
+ std::unique_ptr<sal_uInt16[]> pPercBuf;
+ std::unique_ptr<sal_uInt16[]> pBlockBuf;
sal_uInt16 nPercSize;
long nTotalDist;
long lOldWinPos;
@@ -152,7 +153,7 @@ struct SvxRuler_Impl {
~SvxRuler_Impl()
{
nPercSize = 0; nTotalDist = 0;
- delete[] pPercBuf; delete[] pBlockBuf; pPercBuf = nullptr;
+ pPercBuf = nullptr;
delete pTextRTLItem;
}
void SetPercSize(sal_uInt16 nSize);
@@ -183,14 +184,13 @@ void SvxRuler_Impl::SetPercSize(sal_uInt16 nSize)
{
if(nSize > nPercSize)
{
- delete[] pPercBuf;
- delete[] pBlockBuf;
- pPercBuf = new sal_uInt16[nPercSize = nSize];
- pBlockBuf = new sal_uInt16[nPercSize = nSize];
+ nPercSize = nSize;
+ pPercBuf.reset( new sal_uInt16[nPercSize] );
+ pBlockBuf.reset( new sal_uInt16[nPercSize] );
}
size_t nSize2 = sizeof(sal_uInt16) * nPercSize;
- memset(pPercBuf, 0, nSize2);
- memset(pBlockBuf, 0, nSize2);
+ memset(pPercBuf.get(), 0, nSize2);
+ memset(pBlockBuf.get(), 0, nSize2);
}
// Constructor of the ruler