summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-07-05 08:57:43 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-05 11:30:12 +0200
commitb0e05f9ade9e93c569c6a62c59ac1819e615f27b (patch)
tree61cbf40294b73e5dbc92213c23f1d89dd8998092 /basic
parent1a637473b5aa6a43acb4d1f820044fba962cc6a4 (diff)
loplugin:useuniqueptr in basic..cppcanvas
Change-Id: Ib40241eb794607154ae52f8aa68fbf5ea5e944af Reviewed-on: https://gerrit.libreoffice.org/39551 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/inc/runtime.hxx19
-rw-r--r--basic/source/runtime/runtime.cxx11
2 files changed, 11 insertions, 19 deletions
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index 4c7dfa965c9d..6b390ff2f078 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -65,26 +65,19 @@ struct SbiForStack { // for/next stack:
// For each support
ForType eForType;
sal_Int32 nCurCollectionIndex;
- sal_Int32* pArrayCurIndices;
- sal_Int32* pArrayLowerBounds;
- sal_Int32* pArrayUpperBounds;
+ std::unique_ptr<sal_Int32[]>
+ pArrayCurIndices;
+ std::unique_ptr<sal_Int32[]>
+ pArrayLowerBounds;
+ std::unique_ptr<sal_Int32[]>
+ pArrayUpperBounds;
css::uno::Reference< css::container::XEnumeration > xEnumeration;
SbiForStack()
: pNext(nullptr)
, eForType(ForType::To)
, nCurCollectionIndex(0)
- , pArrayCurIndices(nullptr)
- , pArrayLowerBounds(nullptr)
- , pArrayUpperBounds(nullptr)
{}
-
- ~SbiForStack()
- {
- delete[] pArrayCurIndices;
- delete[] pArrayLowerBounds;
- delete[] pArrayUpperBounds;
- }
};
#define MAXRECURSION 500
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 41e3e8afd7e6..6038dadd736e 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -1122,9 +1122,9 @@ void SbiRuntime::PushForEach()
p->refEnd = reinterpret_cast<SbxVariable*>(pArray);
short nDims = pArray->GetDims();
- p->pArrayLowerBounds = new sal_Int32[nDims];
- p->pArrayUpperBounds = new sal_Int32[nDims];
- p->pArrayCurIndices = new sal_Int32[nDims];
+ p->pArrayLowerBounds.reset( new sal_Int32[nDims] );
+ p->pArrayUpperBounds.reset( new sal_Int32[nDims] );
+ p->pArrayCurIndices.reset( new sal_Int32[nDims] );
sal_Int32 lBound, uBound;
for( short i = 0 ; i < nDims ; i++ )
{
@@ -2985,7 +2985,7 @@ void SbiRuntime::StepTESTFOR( sal_uInt32 nOp1 )
bEndLoop = true;
break;
}
- SbxVariable* pVal = pArray->Get32( p->pArrayCurIndices );
+ SbxVariable* pVal = pArray->Get32( p->pArrayCurIndices.get() );
*(p->refVar) = *pVal;
bool bFoundNext = false;
@@ -3002,8 +3002,7 @@ void SbiRuntime::StepTESTFOR( sal_uInt32 nOp1 )
}
if( !bFoundNext )
{
- delete[] p->pArrayCurIndices;
- p->pArrayCurIndices = nullptr;
+ p->pArrayCurIndices.reset();
}
}
break;