summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-07-11 12:11:36 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-07-11 15:09:57 +0200
commit87633bd4e3a1b37ccfe1ddf18f1f178b07092a0d (patch)
tree236c705ee7a0ceaea1c5dc1a41665ad2f02a5b53 /sw
parent093744321759b4e3d73d767459272addfb22cf04 (diff)
loplugin:useuniqueptr in sw
Change-Id: I50c8697d51c480c668c66a1cdc2c670575a1ec37 Reviewed-on: https://gerrit.libreoffice.org/39804 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/doccomp.cxx102
-rw-r--r--sw/source/core/inc/UndoDraw.hxx7
-rw-r--r--sw/source/core/undo/undraw.cxx87
-rw-r--r--sw/source/core/unocore/unosrch.cxx43
-rw-r--r--sw/source/filter/ascii/parasc.cxx32
-rw-r--r--sw/source/filter/ww8/rtfsdrexport.cxx4
-rw-r--r--sw/source/filter/ww8/rtfsdrexport.hxx3
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx31
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx31
-rw-r--r--sw/source/filter/ww8/ww8scan.hxx7
10 files changed, 138 insertions, 209 deletions
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 9abc001f9530..b3fad40f8c08 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -45,11 +45,9 @@
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <cstddef>
-#include <vector>
-
#include <list>
-
#include <memory>
+#include <vector>
using namespace ::com::sun::star;
@@ -86,8 +84,8 @@ class CompareData
protected:
SwDoc& rDoc;
private:
- size_t* pIndex;
- bool* pChangedFlag;
+ std::unique_ptr<size_t[]> pIndex;
+ std::unique_ptr<bool[]> pChangedFlag;
SwPaM *pInsRing, *pDelRing;
@@ -190,13 +188,12 @@ class Hash
: nNext( 0 ), nHash( 0 ), pLine(nullptr) {}
};
- sal_uLong* pHashArr;
- HashData* pDataArr;
+ std::unique_ptr<sal_uLong[]> pHashArr;
+ std::unique_ptr<HashData[]> pDataArr;
sal_uLong nCount, nPrime;
public:
explicit Hash( sal_uLong nSize );
- ~Hash();
void CalcHashValue( CompareData& rData );
@@ -208,13 +205,12 @@ class Compare
public:
class MovedData
{
- sal_uLong* pIndex;
- sal_uLong* pLineNum;
+ std::unique_ptr<sal_uLong[]> pIndex;
+ std::unique_ptr<sal_uLong[]> pLineNum;
sal_uLong nCount;
public:
MovedData( CompareData& rData, const sal_Char* pDiscard );
- ~MovedData();
sal_uLong GetIndex( sal_uLong n ) const { return pIndex[ n ]; }
sal_uLong GetLineNum( sal_uLong n ) const { return pLineNum[ n ]; }
@@ -279,14 +275,13 @@ class WordArrayComparator : public ArrayComparator
{
private:
const SwTextNode *pTextNd1, *pTextNd2;
- int *pPos1, *pPos2;
+ std::unique_ptr<int[]> pPos1, pPos2;
int nCnt1, nCnt2; // number of words
static void CalcPositions( int *pPos, const SwTextNode *pTextNd, int &nCnt );
public:
WordArrayComparator( const SwTextNode *pNode1, const SwTextNode *pNode2 );
- virtual ~WordArrayComparator() override;
virtual bool Compare( int nIdx1, int nIdx2 ) const override;
virtual int GetLen1() const override { return nCnt1; }
@@ -353,8 +348,8 @@ class LgstCommonSubseq: public CommonSubseq
private:
static const int CUTOFF = 1<<20; // Stop recursion at this value
- int *pL1, *pL2;
- int *pBuff1, *pBuff2;
+ std::unique_ptr<int[]> pL1, pL2;
+ std::unique_ptr<int[]> pBuff1, pBuff2;
void FindL( int *pL, int nStt1, int nEnd1, int nStt2, int nEnd2 );
int HirschbergLCS( int *pLcs1, int *pLcs2, int nStt1, int nEnd1,
@@ -362,7 +357,6 @@ private:
public:
explicit LgstCommonSubseq( ArrayComparator &rComparator );
- ~LgstCommonSubseq();
int Find( int *pSubseq1, int *pSubseq2 );
};
@@ -403,17 +397,14 @@ CompareData::~CompareData()
delete pInsRing->GetNext();
delete pInsRing;
}
-
- delete[] pIndex;
- delete[] pChangedFlag;
}
void CompareData::SetIndex( size_t nLine, size_t nIndex )
{
if( !pIndex )
{
- pIndex = new size_t[ aLines.size() ];
- memset( pIndex, 0, aLines.size() * sizeof( size_t ) );
+ pIndex.reset( new size_t[ aLines.size() ] );
+ memset( pIndex.get(), 0, aLines.size() * sizeof( size_t ) );
}
if( nLine < aLines.size() )
pIndex[ nLine ] = nIndex;
@@ -423,8 +414,8 @@ void CompareData::SetChanged( size_t nLine, bool bFlag )
{
if( !pChangedFlag )
{
- pChangedFlag = new bool[ aLines.size() +1 ];
- memset( pChangedFlag, 0, (aLines.size() +1) * sizeof( bool ) );
+ pChangedFlag.reset( new bool[ aLines.size() +1 ] );
+ memset( pChangedFlag.get(), 0, (aLines.size() +1) * sizeof( bool ) );
}
if( nLine < aLines.size() )
pChangedFlag[ nLine ] = bFlag;
@@ -529,7 +520,7 @@ static const sal_uLong primes[] =
};
int i;
- pDataArr = new HashData[ nSize ];
+ pDataArr.reset( new HashData[ nSize ] );
pDataArr[0].nNext = 0;
pDataArr[0].nHash = 0;
pDataArr[0].pLine = nullptr;
@@ -542,14 +533,8 @@ static const sal_uLong primes[] =
return;
}
nPrime = primes[ i ];
- pHashArr = new sal_uLong[ nPrime ];
- memset( pHashArr, 0, nPrime * sizeof( sal_uLong ) );
-}
-
-Hash::~Hash()
-{
- delete[] pHashArr;
- delete[] pDataArr;
+ pHashArr.reset( new sal_uLong[ nPrime ] );
+ memset( pHashArr.get(), 0, nPrime * sizeof( sal_uLong ) );
}
void Hash::CalcHashValue( CompareData& rData )
@@ -785,8 +770,8 @@ Compare::MovedData::MovedData( CompareData& rData, const sal_Char* pDiscard )
if( nCount )
{
- pIndex = new sal_uLong[ nCount ];
- pLineNum = new sal_uLong[ nCount ];
+ pIndex.reset( new sal_uLong[ nCount ] );
+ pLineNum.reset( new sal_uLong[ nCount ] );
for( n = 0, nCount = 0; n < nLen; ++n )
if( !pDiscard[ n ] )
@@ -797,12 +782,6 @@ Compare::MovedData::MovedData( CompareData& rData, const sal_Char* pDiscard )
}
}
-Compare::MovedData::~MovedData()
-{
- delete [] pIndex;
- delete [] pLineNum;
-}
-
/// Find the differing lines
Compare::CompareSequence::CompareSequence(
CompareData& rD1, CompareData& rD2,
@@ -2249,17 +2228,11 @@ WordArrayComparator::WordArrayComparator( const SwTextNode *pNode1,
const SwTextNode *pNode2 )
: pTextNd1( pNode1 ), pTextNd2( pNode2 )
{
- pPos1 = new int[ pTextNd1->GetText().getLength() + 1 ];
- pPos2 = new int[ pTextNd2->GetText().getLength() + 1 ];
+ pPos1.reset( new int[ pTextNd1->GetText().getLength() + 1 ] );
+ pPos2.reset( new int[ pTextNd2->GetText().getLength() + 1 ] );
- CalcPositions( pPos1, pTextNd1, nCnt1 );
- CalcPositions( pPos2, pTextNd2, nCnt2 );
-}
-
-WordArrayComparator::~WordArrayComparator()
-{
- delete[] pPos1;
- delete[] pPos2;
+ CalcPositions( pPos1.get(), pTextNd1, nCnt1 );
+ CalcPositions( pPos2.get(), pTextNd2, nCnt2 );
}
bool WordArrayComparator::Compare( int nIdx1, int nIdx2 ) const
@@ -2444,20 +2417,11 @@ int CommonSubseq::IgnoreIsolatedPieces( int *pLcs1, int *pLcs2, int nLen1,
LgstCommonSubseq::LgstCommonSubseq( ArrayComparator &rComparator )
: CommonSubseq( rComparator, CUTOFF )
{
- pBuff1 = new int[ rComparator.GetLen2() + 1 ];
- pBuff2 = new int[ rComparator.GetLen2() + 1 ];
-
- pL1 = new int[ rComparator.GetLen2() + 1 ];
- pL2 = new int[ rComparator.GetLen2() + 1 ];
-}
-
-LgstCommonSubseq::~LgstCommonSubseq()
-{
- delete[] pBuff1;
- delete[] pBuff2;
+ pBuff1.reset( new int[ rComparator.GetLen2() + 1 ] );
+ pBuff2.reset( new int[ rComparator.GetLen2() + 1 ] );
- delete[] pL1;
- delete[] pL2;
+ pL1.reset( new int[ rComparator.GetLen2() + 1 ] );
+ pL2.reset( new int[ rComparator.GetLen2() + 1 ] );
}
void LgstCommonSubseq::FindL( int *pL, int nStt1, int nEnd1,
@@ -2466,8 +2430,8 @@ void LgstCommonSubseq::FindL( int *pL, int nStt1, int nEnd1,
int nLen1 = nEnd1 ? nEnd1 - nStt1 : rCmp.GetLen1();
int nLen2 = nEnd2 ? nEnd2 - nStt2 : rCmp.GetLen2();
- int *currL = pBuff1;
- int *prevL = pBuff2;
+ int *currL = pBuff1.get();
+ int *prevL = pBuff2.get();
// Avoid memory corruption
if( nLen2 > rCmp.GetLen2() )
@@ -2476,8 +2440,8 @@ void LgstCommonSubseq::FindL( int *pL, int nStt1, int nEnd1,
return;
}
- memset( pBuff1, 0, sizeof( *pBuff1 ) * ( nLen2 + 1 ) );
- memset( pBuff2, 0, sizeof( *pBuff2 ) * ( nLen2 + 1 ) );
+ memset( pBuff1.get(), 0, sizeof( *pBuff1.get() ) * ( nLen2 + 1 ) );
+ memset( pBuff2.get(), 0, sizeof( *pBuff2.get() ) * ( nLen2 + 1 ) );
// Find lcs
for( int i = 1; i <= nLen1; i++ )
@@ -2515,8 +2479,8 @@ int LgstCommonSubseq::HirschbergLCS( int *pLcs1, int *pLcs2, int nStt1,
int nMid = nLen1/2;
- FindL( pL1, nStt1, nStt1 + nMid, nStt2, nEnd2 );
- FindL( pL2, nStt1 + nMid, nEnd1, nStt2, nEnd2 );
+ FindL( pL1.get(), nStt1, nStt1 + nMid, nStt2, nEnd2 );
+ FindL( pL2.get(), nStt1 + nMid, nEnd1, nStt2, nEnd2 );
int nMaxPos = 0;
static int nMaxVal;
diff --git a/sw/source/core/inc/UndoDraw.hxx b/sw/source/core/inc/UndoDraw.hxx
index 5b2c023f5a17..3a758af6c86c 100644
--- a/sw/source/core/inc/UndoDraw.hxx
+++ b/sw/source/core/inc/UndoDraw.hxx
@@ -22,6 +22,7 @@
#include <undobj.hxx>
#include <svx/svdundo.hxx>
+#include <memory>
struct SwUndoGroupObjImpl;
class SdrMark;
@@ -51,7 +52,7 @@ public:
class SwUndoDrawGroup : public SwUndo
{
- SwUndoGroupObjImpl* pObjArr;
+ std::unique_ptr<SwUndoGroupObjImpl[]> pObjArr;
sal_uInt16 nSize;
bool bDelFormat;
@@ -80,7 +81,7 @@ public:
// contact object.
class SwUndoDrawUnGroup : public SwUndo
{
- SwUndoGroupObjImpl* pObjArr;
+ std::unique_ptr<SwUndoGroupObjImpl[]> pObjArr;
sal_uInt16 nSize;
bool bDelFormat;
@@ -114,7 +115,7 @@ public:
class SwUndoDrawDelete : public SwUndo
{
- SwUndoGroupObjImpl* pObjArr;
+ std::unique_ptr<SwUndoGroupObjImpl[]> pObjArr;
SdrMarkList* pMarkLst; // MarkList for all selected SdrObjects
sal_uInt16 nSize;
bool bDelFormat;
diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx
index 7419163ef948..683c29b22645 100644
--- a/sw/source/core/undo/undraw.cxx
+++ b/sw/source/core/undo/undraw.cxx
@@ -187,21 +187,19 @@ static void lcl_RestoreAnchor( SwFrameFormat* pFormat, sal_uLong& rNodePos )
SwUndoDrawGroup::SwUndoDrawGroup( sal_uInt16 nCnt, const SwDoc* pDoc )
: SwUndo( SwUndoId::DRAWGROUP, pDoc ), nSize( nCnt + 1 ), bDelFormat( true )
{
- pObjArr = new SwUndoGroupObjImpl[ nSize ];
+ pObjArr.reset( new SwUndoGroupObjImpl[ nSize ] );
}
SwUndoDrawGroup::~SwUndoDrawGroup()
{
if( bDelFormat )
{
- SwUndoGroupObjImpl* pTmp = pObjArr + 1;
+ SwUndoGroupObjImpl* pTmp = pObjArr.get() + 1;
for( sal_uInt16 n = 1; n < nSize; ++n, ++pTmp )
delete pTmp->pFormat;
}
else
- delete pObjArr->pFormat;
-
- delete [] pObjArr;
+ delete pObjArr[0].pFormat;
}
void SwUndoDrawGroup::UndoImpl(::sw::UndoRedoContext &)
@@ -209,13 +207,13 @@ void SwUndoDrawGroup::UndoImpl(::sw::UndoRedoContext &)
bDelFormat = false;
// save group object
- SwDrawFrameFormat* pFormat = pObjArr->pFormat;
+ SwDrawFrameFormat* pFormat = pObjArr[0].pFormat;
- pFormat->CallSwClientNotify(sw::ContactChangedHint(&pObjArr->pObj));
- auto pObj = pObjArr->pObj;
+ pFormat->CallSwClientNotify(sw::ContactChangedHint(&pObjArr[0].pObj));
+ auto pObj = pObjArr[0].pObj;
pObj->SetUserCall(nullptr);
- ::lcl_SaveAnchor( pFormat, pObjArr->nNodeIdx );
+ ::lcl_SaveAnchor( pFormat, pObjArr[0].nNodeIdx );
// notify UNO objects to decouple
::lcl_SendRemoveToUno( *pFormat );
@@ -227,7 +225,7 @@ void SwUndoDrawGroup::UndoImpl(::sw::UndoRedoContext &)
for( sal_uInt16 n = 1; n < nSize; ++n )
{
- SwUndoGroupObjImpl& rSave = *( pObjArr + n );
+ SwUndoGroupObjImpl& rSave = pObjArr[n];
::lcl_RestoreAnchor( rSave.pFormat, rSave.nNodeIdx );
rFlyFormats.push_back( rSave.pFormat );
@@ -254,12 +252,12 @@ void SwUndoDrawGroup::RedoImpl(::sw::UndoRedoContext &)
bDelFormat = true;
// remove from array
- SwDoc* pDoc = pObjArr->pFormat->GetDoc();
+ SwDoc* pDoc = pObjArr[0].pFormat->GetDoc();
SwFrameFormats& rFlyFormats = *pDoc->GetSpzFrameFormats();
for( sal_uInt16 n = 1; n < nSize; ++n )
{
- SwUndoGroupObjImpl& rSave = *( pObjArr + n );
+ SwUndoGroupObjImpl& rSave = pObjArr[n];
SdrObject* pObj = rSave.pObj;
@@ -278,16 +276,16 @@ void SwUndoDrawGroup::RedoImpl(::sw::UndoRedoContext &)
}
// re-insert group object
- ::lcl_RestoreAnchor( pObjArr->pFormat, pObjArr->nNodeIdx );
- rFlyFormats.push_back( pObjArr->pFormat );
+ ::lcl_RestoreAnchor( pObjArr[0].pFormat, pObjArr[0].nNodeIdx );
+ rFlyFormats.push_back( pObjArr[0].pFormat );
- SwDrawContact *pContact = new SwDrawContact( pObjArr->pFormat, pObjArr->pObj );
+ SwDrawContact *pContact = new SwDrawContact( pObjArr[0].pFormat, pObjArr[0].pObj );
// #i26791# - correction: connect object to layout
pContact->ConnectToLayout();
// #i45718# - follow-up of #i35635# move object to visible layer
- pContact->MoveObjToVisibleLayer( pObjArr->pObj );
+ pContact->MoveObjToVisibleLayer( pObjArr[0].pObj );
- SwDrawFrameFormat* pDrawFrameFormat = dynamic_cast<SwDrawFrameFormat*>(pObjArr->pFormat);
+ SwDrawFrameFormat* pDrawFrameFormat = dynamic_cast<SwDrawFrameFormat*>(pObjArr[0].pFormat);
// #i45952# - notify that position attributes are already set
OSL_ENSURE(pDrawFrameFormat,
@@ -298,7 +296,7 @@ void SwUndoDrawGroup::RedoImpl(::sw::UndoRedoContext &)
void SwUndoDrawGroup::AddObj( sal_uInt16 nPos, SwDrawFrameFormat* pFormat, SdrObject* pObj )
{
- SwUndoGroupObjImpl& rSave = *( pObjArr + nPos + 1 );
+ SwUndoGroupObjImpl& rSave = pObjArr[nPos + 1];
rSave.pObj = pObj;
rSave.pFormat = pFormat;
::lcl_SaveAnchor( pFormat, rSave.nNodeIdx );
@@ -313,27 +311,27 @@ void SwUndoDrawGroup::AddObj( sal_uInt16 nPos, SwDrawFrameFormat* pFormat, SdrOb
void SwUndoDrawGroup::SetGroupFormat( SwDrawFrameFormat* pFormat )
{
- pObjArr->pObj = nullptr;
- pObjArr->pFormat = pFormat;
+ pObjArr[0].pObj = nullptr;
+ pObjArr[0].pFormat = pFormat;
}
SwUndoDrawUnGroup::SwUndoDrawUnGroup( SdrObjGroup* pObj, const SwDoc* pDoc )
: SwUndo( SwUndoId::DRAWUNGROUP, pDoc ), bDelFormat( false )
{
nSize = (sal_uInt16)pObj->GetSubList()->GetObjCount() + 1;
- pObjArr = new SwUndoGroupObjImpl[ nSize ];
+ pObjArr.reset( new SwUndoGroupObjImpl[ nSize ] );
SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
SwDrawFrameFormat* pFormat = static_cast<SwDrawFrameFormat*>(pContact->GetFormat());
- pObjArr->pObj = pObj;
- pObjArr->pFormat = pFormat;
+ pObjArr[0].pObj = pObj;
+ pObjArr[0].pFormat = pFormat;
// object will destroy itself
pContact->Changed( *pObj, SdrUserCallType::Delete, pObj->GetLastBoundRect() );
pObj->SetUserCall( nullptr );
- ::lcl_SaveAnchor( pFormat, pObjArr->nNodeIdx );
+ ::lcl_SaveAnchor( pFormat, pObjArr[0].nNodeIdx );
// notify UNO objects to decouple
::lcl_SendRemoveToUno( *pFormat );
@@ -347,14 +345,12 @@ SwUndoDrawUnGroup::~SwUndoDrawUnGroup()
{
if( bDelFormat )
{
- SwUndoGroupObjImpl* pTmp = pObjArr + 1;
+ SwUndoGroupObjImpl* pTmp = pObjArr.get() + 1;
for( sal_uInt16 n = 1; n < nSize; ++n, ++pTmp )
delete pTmp->pFormat;
}
else
- delete pObjArr->pFormat;
-
- delete [] pObjArr;
+ delete pObjArr[0].pFormat;
}
void SwUndoDrawUnGroup::UndoImpl(::sw::UndoRedoContext & rContext)
@@ -367,7 +363,7 @@ void SwUndoDrawUnGroup::UndoImpl(::sw::UndoRedoContext & rContext)
// remove from array
for( sal_uInt16 n = 1; n < nSize; ++n )
{
- SwUndoGroupObjImpl& rSave = *( pObjArr + n );
+ SwUndoGroupObjImpl& rSave = pObjArr[n];
::lcl_SaveAnchor( rSave.pFormat, rSave.nNodeIdx );
@@ -378,15 +374,15 @@ void SwUndoDrawUnGroup::UndoImpl(::sw::UndoRedoContext & rContext)
}
// re-insert group object
- ::lcl_RestoreAnchor( pObjArr->pFormat, pObjArr->nNodeIdx );
- rFlyFormats.push_back( pObjArr->pFormat );
+ ::lcl_RestoreAnchor( pObjArr[0].pFormat, pObjArr[0].nNodeIdx );
+ rFlyFormats.push_back( pObjArr[0].pFormat );
- SwDrawContact *pContact = new SwDrawContact( pObjArr->pFormat, pObjArr->pObj );
+ SwDrawContact *pContact = new SwDrawContact( pObjArr[0].pFormat, pObjArr[0].pObj );
pContact->ConnectToLayout();
// #i45718# - follow-up of #i35635# move object to visible layer
- pContact->MoveObjToVisibleLayer( pObjArr->pObj );
+ pContact->MoveObjToVisibleLayer( pObjArr[0].pObj );
- SwDrawFrameFormat* pDrawFrameFormat = dynamic_cast<SwDrawFrameFormat*>(pObjArr->pFormat);
+ SwDrawFrameFormat* pDrawFrameFormat = dynamic_cast<SwDrawFrameFormat*>(pObjArr[0].pFormat);
// #i45952# - notify that position attributes are already set
OSL_ENSURE(pDrawFrameFormat,
@@ -400,11 +396,11 @@ void SwUndoDrawUnGroup::RedoImpl(::sw::UndoRedoContext &)
bDelFormat = false;
// save group object
- SwDrawFrameFormat* pFormat = pObjArr->pFormat;
- pFormat->CallSwClientNotify(sw::ContactChangedHint(&(pObjArr->pObj)));
- pObjArr->pObj->SetUserCall( nullptr );
+ SwDrawFrameFormat* pFormat = pObjArr[0].pFormat;
+ pFormat->CallSwClientNotify(sw::ContactChangedHint(&(pObjArr[0].pObj)));
+ pObjArr[0].pObj->SetUserCall( nullptr );
- ::lcl_SaveAnchor( pFormat, pObjArr->nNodeIdx );
+ ::lcl_SaveAnchor( pFormat, pObjArr[0].nNodeIdx );
// notify UNO objects to decouple
::lcl_SendRemoveToUno( *pFormat );
@@ -416,7 +412,7 @@ void SwUndoDrawUnGroup::RedoImpl(::sw::UndoRedoContext &)
for( sal_uInt16 n = 1; n < nSize; ++n )
{
- SwUndoGroupObjImpl& rSave = *( pObjArr + n );
+ SwUndoGroupObjImpl& rSave = pObjArr[n];
::lcl_RestoreAnchor( rSave.pFormat, rSave.nNodeIdx );
rFlyFormats.push_back( rSave.pFormat );
@@ -433,7 +429,7 @@ void SwUndoDrawUnGroup::RedoImpl(::sw::UndoRedoContext &)
void SwUndoDrawUnGroup::AddObj( sal_uInt16 nPos, SwDrawFrameFormat* pFormat )
{
- SwUndoGroupObjImpl& rSave = *( pObjArr + nPos + 1 );
+ SwUndoGroupObjImpl& rSave = pObjArr[ nPos + 1 ];
rSave.pFormat = pFormat;
rSave.pObj = nullptr;
}
@@ -489,7 +485,7 @@ void SwUndoDrawUnGroupConnectToLayout::AddFormatAndObj( SwDrawFrameFormat* pDraw
SwUndoDrawDelete::SwUndoDrawDelete( sal_uInt16 nCnt, const SwDoc* pDoc )
: SwUndo( SwUndoId::DRAWDELETE, pDoc ), nSize( nCnt ), bDelFormat( true )
{
- pObjArr = new SwUndoGroupObjImpl[ nSize ];
+ pObjArr.reset( new SwUndoGroupObjImpl[ nSize ] );
pMarkLst = new SdrMarkList();
}
@@ -497,11 +493,10 @@ SwUndoDrawDelete::~SwUndoDrawDelete()
{
if( bDelFormat )
{
- SwUndoGroupObjImpl* pTmp = pObjArr;
+ SwUndoGroupObjImpl* pTmp = pObjArr.get();
for( size_t n = 0; n < pMarkLst->GetMarkCount(); ++n, ++pTmp )
delete pTmp->pFormat;
}
- delete [] pObjArr;
delete pMarkLst;
}
@@ -511,7 +506,7 @@ void SwUndoDrawDelete::UndoImpl(::sw::UndoRedoContext & rContext)
SwFrameFormats & rFlyFormats = *rContext.GetDoc().GetSpzFrameFormats();
for( size_t n = 0; n < pMarkLst->GetMarkCount(); ++n )
{
- SwUndoGroupObjImpl& rSave = *( pObjArr + n );
+ SwUndoGroupObjImpl& rSave = pObjArr[n];
::lcl_RestoreAnchor( rSave.pFormat, rSave.nNodeIdx );
rFlyFormats.push_back( rSave.pFormat );
SdrObject *pObj = rSave.pObj;
@@ -537,7 +532,7 @@ void SwUndoDrawDelete::RedoImpl(::sw::UndoRedoContext & rContext)
SwFrameFormats & rFlyFormats = *rContext.GetDoc().GetSpzFrameFormats();
for( size_t n = 0; n < pMarkLst->GetMarkCount(); ++n )
{
- SwUndoGroupObjImpl& rSave = *( pObjArr + n );
+ SwUndoGroupObjImpl& rSave = pObjArr[n];
SdrObject *pObj = rSave.pObj;
SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj));
SwDrawFrameFormat *pFormat = static_cast<SwDrawFrameFormat*>(pContact->GetFormat());
@@ -557,7 +552,7 @@ void SwUndoDrawDelete::RedoImpl(::sw::UndoRedoContext & rContext)
void SwUndoDrawDelete::AddObj( SwDrawFrameFormat* pFormat,
const SdrMark& rMark )
{
- SwUndoGroupObjImpl& rSave = *( pObjArr + pMarkLst->GetMarkCount() );
+ SwUndoGroupObjImpl& rSave = pObjArr[ pMarkLst->GetMarkCount() ];
rSave.pObj = rMark.GetMarkedSdrObj();
rSave.pFormat = pFormat;
::lcl_SaveAnchor( pFormat, rSave.nNodeIdx );
diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx
index bf70fc5894e6..14033515a8bf 100644
--- a/sw/source/core/unocore/unosrch.cxx
+++ b/sw/source/core/unocore/unosrch.cxx
@@ -33,21 +33,20 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <memory>
using namespace ::com::sun::star;
class SwSearchProperties_Impl
{
- beans::PropertyValue** pValueArr;
- sal_uInt32 nArrLen;
- const PropertyEntryVector_t aPropertyEntries;
+ std::unique_ptr<std::unique_ptr<beans::PropertyValue>[]> pValueArr;
+ const PropertyEntryVector_t aPropertyEntries;
SwSearchProperties_Impl(const SwSearchProperties_Impl&) = delete;
SwSearchProperties_Impl& operator=(const SwSearchProperties_Impl&) = delete;
public:
SwSearchProperties_Impl();
- ~SwSearchProperties_Impl();
/// @throws beans::UnknownPropertyException
/// @throws lang::IllegalArgumentException
@@ -60,31 +59,20 @@ public:
};
SwSearchProperties_Impl::SwSearchProperties_Impl() :
- nArrLen(0),
- aPropertyEntries( aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)->getPropertyMap().getPropertyEntries())
+ aPropertyEntries( aSwMapProvider.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR)->getPropertyMap().getPropertyEntries() )
{
- nArrLen = aPropertyEntries.size();
- pValueArr = new beans::PropertyValue*[nArrLen];
- for(sal_uInt32 i = 0; i < nArrLen; i++)
- pValueArr[i] = nullptr;
+ size_t nArrLen = aPropertyEntries.size();
+ pValueArr.reset( new std::unique_ptr<beans::PropertyValue>[nArrLen] );
}
-SwSearchProperties_Impl::~SwSearchProperties_Impl()
-{
- for(sal_uInt32 i = 0; i < nArrLen; i++)
- delete pValueArr[i];
- delete[] pValueArr;
-}
-
-void SwSearchProperties_Impl::SetProperties(const uno::Sequence< beans::PropertyValue >& aSearchAttribs)
+void SwSearchProperties_Impl::SetProperties(const uno::Sequence< beans::PropertyValue >& aSearchAttribs)
{
const beans::PropertyValue* pProps = aSearchAttribs.getConstArray();
//delete all existing values
- for(sal_uInt32 i = 0; i < nArrLen; ++i)
+ for(size_t i = 0; i < aPropertyEntries.size(); ++i)
{
- delete pValueArr[i];
- pValueArr[i] = nullptr;
+ pValueArr[i].reset();
}
const sal_uInt32 nLen = aSearchAttribs.getLength();
@@ -99,22 +87,21 @@ void SwSearchProperties_Impl::SetProperties(const uno::Sequence< beans::Prope
if( aIt == aPropertyEntries.end() )
throw beans::UnknownPropertyException();
}
- pValueArr[nIndex] = new beans::PropertyValue(pProps[i]);
+ pValueArr[nIndex].reset( new beans::PropertyValue(pProps[i]) );
}
}
const uno::Sequence< beans::PropertyValue > SwSearchProperties_Impl::GetProperties() const
{
sal_uInt32 nPropCount = 0;
- sal_uInt32 i;
- for( i = 0; i < nArrLen; i++)
+ for( size_t i = 0; i < aPropertyEntries.size(); i++)
if(pValueArr[i])
nPropCount++;
uno::Sequence< beans::PropertyValue > aRet(nPropCount);
beans::PropertyValue* pProps = aRet.getArray();
nPropCount = 0;
- for(i = 0; i < nArrLen; i++)
+ for(size_t i = 0; i < aPropertyEntries.size(); i++)
{
if(pValueArr[i])
{
@@ -176,7 +163,7 @@ void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, bool bIsValueSearch)
*pShadowItem = nullptr;
PropertyEntryVector_t::const_iterator aIt = aPropertyEntries.begin();
- for(sal_uInt32 i = 0; i < nArrLen; i++, ++aIt)
+ for(size_t i = 0; i < aPropertyEntries.size(); i++, ++aIt)
{
if(pValueArr[i])
{
@@ -470,9 +457,9 @@ void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, bool bIsValueSearch)
delete pShadowItem;
}
-bool SwSearchProperties_Impl::HasAttributes() const
+bool SwSearchProperties_Impl::HasAttributes() const
{
- for(sal_uInt32 i = 0; i < nArrLen; i++)
+ for(size_t i = 0; i < aPropertyEntries.size(); i++)
if(pValueArr[i])
return true;
return false;
diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx
index ab5512b7976d..53e1f1ff9041 100644
--- a/sw/source/filter/ascii/parasc.cxx
+++ b/sw/source/filter/ascii/parasc.cxx
@@ -45,15 +45,16 @@
#include <poolfmt.hxx>
#include <vcl/metric.hxx>
+#include <memory>
#define ASC_BUFFLEN 4096
class SwASCIIParser
{
SwDoc* pDoc;
- SwPaM* pPam;
+ std::unique_ptr<SwPaM> pPam;
SvStream& rInput;
- sal_Char* pArr;
+ std::unique_ptr<sal_Char[]> pArr;
const SwAsciiOptions& rOpt;
std::unique_ptr<SfxItemSet> pItemSet;
long nFileSize;
@@ -69,7 +70,6 @@ class SwASCIIParser
public:
SwASCIIParser( SwDoc* pD, const SwPaM& rCursor, SvStream& rIn,
bool bReadNewDoc, const SwAsciiOptions& rOpts );
- ~SwASCIIParser();
ErrCode CallParser();
};
@@ -98,8 +98,8 @@ SwASCIIParser::SwASCIIParser(SwDoc* pD, const SwPaM& rCursor, SvStream& rIn,
: pDoc(pD), rInput(rIn), rOpt(rOpts), nFileSize(0), nScript(SvtScriptType::NONE)
, bNewDoc(bReadNewDoc)
{
- pPam = new SwPaM( *rCursor.GetPoint() );
- pArr = new sal_Char [ ASC_BUFFLEN + 2 ];
+ pPam.reset( new SwPaM( *rCursor.GetPoint() ) );
+ pArr.reset( new sal_Char [ ASC_BUFFLEN + 2 ] );
pItemSet = o3tl::make_unique<SfxItemSet>( pDoc->GetAttrPool(),
svl::Items<RES_CHRATR_FONT, RES_CHRATR_LANGUAGE,
@@ -131,12 +131,6 @@ SwASCIIParser::SwASCIIParser(SwDoc* pD, const SwPaM& rCursor, SvStream& rIn,
}
}
-SwASCIIParser::~SwASCIIParser()
-{
- delete pPam;
- delete [] pArr;
-}
-
// Calling the parser
ErrCode SwASCIIParser::CallParser()
{
@@ -265,10 +259,10 @@ ErrCode SwASCIIParser::ReadChars()
aEmpty.GetParaFlags() == rOpt.GetParaFlags())
{
sal_uLong nLen, nOrig;
- nOrig = nLen = rInput.ReadBytes(pArr, ASC_BUFFLEN);
+ nOrig = nLen = rInput.ReadBytes(pArr.get(), ASC_BUFFLEN);
rtl_TextEncoding eCharSet;
LineEnd eLineEnd;
- bool bRet = SwIoSystem::IsDetectableText(pArr, nLen, &eCharSet, &bSwapUnicode, &eLineEnd);
+ bool bRet = SwIoSystem::IsDetectableText(pArr.get(), nLen, &eCharSet, &bSwapUnicode, &eLineEnd);
OSL_ENSURE(bRet, "Autodetect of text import without nag dialog must have failed");
if (bRet && eCharSet != RTL_TEXTENCODING_DONTKNOW)
{
@@ -313,7 +307,7 @@ ErrCode SwASCIIParser::ReadChars()
// Read a new block
sal_uLong lGCount;
if( ERRCODE_NONE != rInput.GetError() || 0 == (lGCount =
- rInput.ReadBytes( pArr + nArrOffset,
+ rInput.ReadBytes( pArr.get() + nArrOffset,
ASC_BUFFLEN - nArrOffset )))
break; // break from the while loop
@@ -334,7 +328,7 @@ ErrCode SwASCIIParser::ReadChars()
pBuf[nNewLen] = 0; // ensure '\0'
nNewLen = rtl_convertTextToUnicode( hConverter, hContext,
- pArr, lGCount, pBuf, nNewLen,
+ pArr.get(), lGCount, pBuf, nNewLen,
(
RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_DEFAULT |
RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT |
@@ -344,19 +338,19 @@ ErrCode SwASCIIParser::ReadChars()
&nInfo,
&nCntBytes );
if( 0 != ( nArrOffset = lGCount - nCntBytes ) )
- memmove( pArr, pArr + nCntBytes, nArrOffset );
+ memmove( pArr.get(), pArr.get() + nCntBytes, nArrOffset );
pStt = pLastStt = aWork.get();
pEnd = pStt + nNewLen;
}
else
{
- pStt = pLastStt = reinterpret_cast<sal_Unicode*>(pArr);
- pEnd = reinterpret_cast<sal_Unicode*>(pArr + lGCount);
+ pStt = pLastStt = reinterpret_cast<sal_Unicode*>(pArr.get());
+ pEnd = reinterpret_cast<sal_Unicode*>(pArr.get() + lGCount);
if( bSwapUnicode )
{
- sal_Char* pF = pArr, *pN = pArr + 1;
+ sal_Char* pF = pArr.get(), *pN = pArr.get() + 1;
for( sal_uLong n = 0; n < lGCount; n += 2, pF += 2, pN += 2 )
{
sal_Char c = *pF;
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index 81ada8000c5b..e77f0d89bd85 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -47,15 +47,13 @@ RtfSdrExport::RtfSdrExport(RtfExport& rExport)
m_pShapeTypeWritten(new bool[ ESCHER_ShpInst_COUNT ])
{
mnGroupLevel = 1;
- memset(m_pShapeTypeWritten, 0, ESCHER_ShpInst_COUNT * sizeof(bool));
+ memset(m_pShapeTypeWritten.get(), 0, ESCHER_ShpInst_COUNT * sizeof(bool));
}
RtfSdrExport::~RtfSdrExport()
{
delete mpOutStrm;
mpOutStrm = nullptr;
- delete[] m_pShapeTypeWritten;
- m_pShapeTypeWritten = nullptr;
}
void RtfSdrExport::OpenContainer(sal_uInt16 nEscherContainer, int nRecInstance)
diff --git a/sw/source/filter/ww8/rtfsdrexport.hxx b/sw/source/filter/ww8/rtfsdrexport.hxx
index ec3167394430..2b1302ec0042 100644
--- a/sw/source/filter/ww8/rtfsdrexport.hxx
+++ b/sw/source/filter/ww8/rtfsdrexport.hxx
@@ -25,6 +25,7 @@
#include <rtl/strbuf.hxx>
#include <map>
+#include <memory>
#include <set>
#include <wrtww8.hxx>
@@ -54,7 +55,7 @@ class RtfSdrExport : public EscherEx
std::map<OString,OString> m_aShapeProps;
/// Remember which shape types we had already written.
- bool* m_pShapeTypeWritten;
+ std::unique_ptr<bool[]> m_pShapeTypeWritten;
public:
explicit RtfSdrExport(RtfExport& rExport);
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 311ba44f28e4..1eb65c014790 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -4510,9 +4510,9 @@ void WW8AttributeOutput::ParaWidows( const SvxWidowsItem& rWidows )
class SwWW8WrTabu
{
- sal_uInt8* pDel; // DelArray
- sal_uInt8* pAddPos; // AddPos-Array
- sal_uInt8* pAddTyp; // AddTyp-Array
+ std::unique_ptr<sal_uInt8[]> pDel; // DelArray
+ std::unique_ptr<sal_uInt8[]> pAddPos; // AddPos-Array
+ std::unique_ptr<sal_uInt8[]> pAddTyp; // AddTyp-Array
sal_uInt16 nAdd; // number of tabs to be added
sal_uInt16 nDel; // number of tabs to be deleted
@@ -4521,7 +4521,6 @@ class SwWW8WrTabu
public:
SwWW8WrTabu(sal_uInt16 nDelMax, sal_uInt16 nAddMax);
- ~SwWW8WrTabu();
void Add(const SvxTabStop &rTS, long nAdjustment);
void Del(const SvxTabStop &rTS, long nAdjustment);
@@ -4531,16 +4530,10 @@ public:
SwWW8WrTabu::SwWW8WrTabu(sal_uInt16 nDelMax, sal_uInt16 nAddMax)
: nAdd(0), nDel(0)
{
- pDel = nDelMax ? new sal_uInt8[nDelMax * 2] : nullptr;
- pAddPos = new sal_uInt8[nAddMax * 2];
- pAddTyp = new sal_uInt8[nAddMax];
-}
-
-SwWW8WrTabu::~SwWW8WrTabu()
-{
- delete[] pAddTyp;
- delete[] pAddPos;
- delete[] pDel;
+ if (nDelMax)
+ pDel.reset( new sal_uInt8[nDelMax * 2] );
+ pAddPos.reset( new sal_uInt8[nAddMax * 2] );
+ pAddTyp.reset( new sal_uInt8[nAddMax] );
}
/**
@@ -4550,7 +4543,7 @@ void SwWW8WrTabu::Add(const SvxTabStop & rTS, long nAdjustment)
{
// insert tab position
ShortToSVBT16(msword_cast<sal_Int16>(rTS.GetTabPos() + nAdjustment),
- pAddPos + (nAdd * 2));
+ pAddPos.get() + (nAdd * 2));
// insert tab type
sal_uInt8 nPara = 0;
@@ -4602,7 +4595,7 @@ void SwWW8WrTabu::Del(const SvxTabStop &rTS, long nAdjustment)
{
// insert tab position
ShortToSVBT16(msword_cast<sal_Int16>(rTS.GetTabPos() + nAdjustment),
- pDel + (nDel * 2));
+ pDel.get() + (nDel * 2));
++nDel;
}
@@ -4629,11 +4622,11 @@ void SwWW8WrTabu::PutAll(WW8Export& rWrt)
rWrt.pO->push_back(msword_cast<sal_uInt8>(nSiz));
// write DelArr
rWrt.pO->push_back(msword_cast<sal_uInt8>(nDel));
- rWrt.OutSprmBytes(pDel, nDel * 2);
+ rWrt.OutSprmBytes(pDel.get(), nDel * 2);
// write InsArr
rWrt.pO->push_back(msword_cast<sal_uInt8>(nAdd));
- rWrt.OutSprmBytes(pAddPos, 2 * nAdd); // AddPosArray
- rWrt.OutSprmBytes(pAddTyp, nAdd); // AddTypArray
+ rWrt.OutSprmBytes(pAddPos.get(), 2 * nAdd); // AddPosArray
+ rWrt.OutSprmBytes(pAddTyp.get(), nAdd); // AddTypArray
}
static void ParaTabStopAdd( WW8Export& rWrt,
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 0512ab977b98..1c639e3c5a50 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -1671,8 +1671,8 @@ WW8ScannerBase::WW8ScannerBase( SvStream* pSt, SvStream* pTableSt,
sal_uInt64 const nOldPos = pTableSt->Tell();
if (checkSeek(*pTableSt, pWwFib->m_fcAtrdExtra) && (pTableSt->remainingSize() >= pWwFib->m_lcbAtrdExtra))
{
- m_pExtendedAtrds = new sal_uInt8[pWwFib->m_lcbAtrdExtra];
- pWwFib->m_lcbAtrdExtra = pTableSt->ReadBytes(m_pExtendedAtrds, pWwFib->m_lcbAtrdExtra);
+ m_pExtendedAtrds.reset( new sal_uInt8[pWwFib->m_lcbAtrdExtra] );
+ pWwFib->m_lcbAtrdExtra = pTableSt->ReadBytes(m_pExtendedAtrds.get(), pWwFib->m_lcbAtrdExtra);
}
else
pWwFib->m_lcbAtrdExtra = 0;
@@ -1737,7 +1737,6 @@ WW8ScannerBase::~WW8ScannerBase()
delete m_pHdFtTxbxBkd;
delete m_pMagicTables;
delete m_pSubdocs;
- delete [] m_pExtendedAtrds;
}
// Fields
@@ -3378,18 +3377,15 @@ WW8PLCFx_SEPX::WW8PLCFx_SEPX(SvStream* pSt, SvStream* pTableSt,
: WW8PLCFx(rFib, true), maSprmParser(rFib),
pStrm(pSt), nArrMax(256), nSprmSiz(0)
{
- pPLCF = rFib.m_lcbPlcfsed
- ? new WW8PLCF(*pTableSt, rFib.m_fcPlcfsed, rFib.m_lcbPlcfsed,
- GetFIBVersion() <= ww::eWW2 ? 6 : 12, nStartCp)
- : nullptr;
+ if (rFib.m_lcbPlcfsed)
+ pPLCF.reset( new WW8PLCF(*pTableSt, rFib.m_fcPlcfsed, rFib.m_lcbPlcfsed,
+ GetFIBVersion() <= ww::eWW2 ? 6 : 12, nStartCp) );
- pSprms = new sal_uInt8[nArrMax]; // maximum length
+ pSprms.reset( new sal_uInt8[nArrMax] ); // maximum length
}
WW8PLCFx_SEPX::~WW8PLCFx_SEPX()
{
- delete pPLCF;
- delete[] pSprms;
}
sal_uInt32 WW8PLCFx_SEPX::GetIdx() const
@@ -3454,14 +3450,13 @@ void WW8PLCFx_SEPX::GetSprms(WW8PLCFxDesc* p)
if( nSprmSiz > nArrMax )
{ // does not fit
- delete[] pSprms;
nArrMax = nSprmSiz; // Get more memory
- pSprms = new sal_uInt8[nArrMax];
+ pSprms.reset( new sal_uInt8[nArrMax] );
}
- nSprmSiz = pStrm->ReadBytes(pSprms, nSprmSiz); // read Sprms
+ nSprmSiz = pStrm->ReadBytes(pSprms.get(), nSprmSiz); // read Sprms
p->nSprmsLen = nSprmSiz;
- p->pMemPos = pSprms; // return Position
+ p->pMemPos = pSprms.get(); // return Position
}
}
}
@@ -3474,7 +3469,7 @@ void WW8PLCFx_SEPX::advance()
SprmResult WW8PLCFx_SEPX::HasSprm(sal_uInt16 nId) const
{
- return HasSprm(nId, pSprms, nSprmSiz);
+ return HasSprm(nId, pSprms.get(), nSprmSiz);
}
SprmResult WW8PLCFx_SEPX::HasSprm( sal_uInt16 nId, const sal_uInt8* pOtherSprms,
@@ -3497,7 +3492,7 @@ bool WW8PLCFx_SEPX::Find4Sprms(sal_uInt16 nId1,sal_uInt16 nId2,sal_uInt16 nId3,s
bool bFound = false;
- sal_uInt8* pSp = pSprms;
+ sal_uInt8* pSp = pSprms.get();
sal_uInt16 i=0;
while (i + maSprmParser.MinSprmLen() <= nSprmSiz)
{
@@ -3540,7 +3535,7 @@ SprmResult WW8PLCFx_SEPX::HasSprm( sal_uInt16 nId, sal_uInt8 n2nd ) const
if (!pPLCF)
return SprmResult();
- sal_uInt8* pSp = pSprms;
+ sal_uInt8* pSp = pSprms.get();
sal_uInt16 i=0;
while (i + maSprmParser.MinSprmLen() <= nSprmSiz)
@@ -4670,7 +4665,7 @@ WW8PLCFMan::WW8PLCFMan(WW8ScannerBase* pBase, ManTypes nType, long nStartCp,
m_pMagicTables = pBase->m_pMagicTables;
m_pSubdocs = pBase->m_pSubdocs;
- m_pExtendedAtrds = pBase->m_pExtendedAtrds;
+ m_pExtendedAtrds = pBase->m_pExtendedAtrds.get();
switch( nType ) // field initialization
{
diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx
index 91c50f83b510..59560885b015 100644
--- a/sw/source/filter/ww8/ww8scan.hxx
+++ b/sw/source/filter/ww8/ww8scan.hxx
@@ -660,8 +660,8 @@ class WW8PLCFx_SEPX : public WW8PLCFx
private:
wwSprmParser maSprmParser;
SvStream* pStrm;
- WW8PLCF* pPLCF;
- sal_uInt8* pSprms;
+ std::unique_ptr<WW8PLCF> pPLCF;
+ std::unique_ptr<sal_uInt8[]> pSprms;
sal_uInt16 nArrMax;
sal_uInt16 nSprmSiz;
@@ -1052,7 +1052,8 @@ private:
WW8PLCFspecial* m_pHdFtTxbxBkd; // Break-Descriptors for previous
WW8PLCFspecial* m_pMagicTables; // Break-Descriptors for them
WW8PLCFspecial* m_pSubdocs; // subdoc references in master document
- sal_uInt8* m_pExtendedAtrds; // Extended ATRDs
+ std::unique_ptr<sal_uInt8[]>
+ m_pExtendedAtrds; // Extended ATRDs
WW8PLCFx_Book* m_pBook; // Bookmarks
WW8PLCFx_AtnBook* m_pAtnBook; // Annotationmarks
/// Smart tag bookmarks.