summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-18 09:47:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-18 09:26:26 +0000
commit352e036ada79bee79b0b52352cab4b05695b1abf (patch)
treecc6f80c827672e636a4db0e66d68f1edffabb4f7 /svl
parentd0cbdac23ba545091eb9fac8b114cfc20df74ebf (diff)
new loplugin: useuniqueptr: svl..svtools
Change-Id: Ia4d5b37ee3cf67318e3cc01525e4b733af60d038 Reviewed-on: https://gerrit.libreoffice.org/33251 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/filerec/filerec.cxx5
-rw-r--r--svl/source/items/stylepool.cxx3
-rw-r--r--svl/source/notify/isethint.cxx1
-rw-r--r--svl/source/undo/undo.cxx22
4 files changed, 14 insertions, 17 deletions
diff --git a/svl/source/filerec/filerec.cxx b/svl/source/filerec/filerec.cxx
index 2086d2813fc7..0f7cda119d91 100644
--- a/svl/source/filerec/filerec.cxx
+++ b/svl/source/filerec/filerec.cxx
@@ -497,9 +497,9 @@ bool SfxMultiRecordReader::ReadHeader_Impl()
_nContentCount << " claimed, truncating");
_nContentCount = nMaxRecords;
}
- _pContentOfs = new sal_uInt32[_nContentCount]{};
+ _pContentOfs.reset( new sal_uInt32[_nContentCount]{} );
#if defined(OSL_LITENDIAN)
- _pStream->ReadBytes( _pContentOfs, sizeof(sal_uInt32)*_nContentCount );
+ _pStream->ReadBytes( _pContentOfs.get(), sizeof(sal_uInt32)*_nContentCount );
#else
// (loop without braces)
for ( sal_uInt16 n = 0; n < _nContentCount; ++n )
@@ -541,7 +541,6 @@ SfxMultiRecordReader::SfxMultiRecordReader( SvStream *pStream, sal_uInt16 nTag )
SfxMultiRecordReader::~SfxMultiRecordReader()
{
- delete[] _pContentOfs;
}
/**
diff --git a/svl/source/items/stylepool.cxx b/svl/source/items/stylepool.cxx
index 0028b3552768..2fbee928d367 100644
--- a/svl/source/items/stylepool.cxx
+++ b/svl/source/items/stylepool.cxx
@@ -347,7 +347,7 @@ class StylePoolImpl
private:
std::map< const SfxItemSet*, Node > maRoot;
// #i86923#
- SfxItemSet* mpIgnorableItems;
+ std::unique_ptr<SfxItemSet> mpIgnorableItems;
public:
// #i86923#
explicit StylePoolImpl( SfxItemSet* pIgnorableItems )
@@ -364,7 +364,6 @@ public:
~StylePoolImpl()
{
- delete mpIgnorableItems;
}
std::shared_ptr<SfxItemSet> insertItemSet( const SfxItemSet& rSet );
diff --git a/svl/source/notify/isethint.cxx b/svl/source/notify/isethint.cxx
index 9577aefda0c4..6f810240a76d 100644
--- a/svl/source/notify/isethint.cxx
+++ b/svl/source/notify/isethint.cxx
@@ -32,7 +32,6 @@ SfxItemSetHint::SfxItemSetHint( const SfxItemSet &rItemSet )
SfxItemSetHint::~SfxItemSetHint()
{
- delete _pItemSet;
}
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index 2a7d357ab9aa..116e3dff647f 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -223,7 +223,8 @@ typedef ::std::vector< SfxUndoListener* > UndoListeners;
struct SfxUndoManager_Data
{
::osl::Mutex aMutex;
- SfxUndoArray* pUndoArray;
+ std::unique_ptr<SfxUndoArray>
+ pUndoArray;
SfxUndoArray* pActUndoArray;
SfxUndoArray* pFatherUndoArray;
@@ -245,12 +246,11 @@ struct SfxUndoManager_Data
,mbDoing( false )
,mbClearUntilTopLevel( false )
{
- pActUndoArray = pUndoArray;
+ pActUndoArray = pUndoArray.get();
}
~SfxUndoManager_Data()
{
- delete pUndoArray;
}
// Copy assignment is forbidden and not implemented.
@@ -600,7 +600,7 @@ void SfxUndoManager::ImplClearUndo( UndoManagerGuard& i_guard )
void SfxUndoManager::ImplClearRedo( UndoManagerGuard& i_guard, bool const i_currentLevel )
{
- SfxUndoArray* pUndoArray = ( i_currentLevel == IUndoManager::CurrentLevel ) ? m_xData->pActUndoArray : m_xData->pUndoArray;
+ SfxUndoArray* pUndoArray = ( i_currentLevel == IUndoManager::CurrentLevel ) ? m_xData->pActUndoArray : m_xData->pUndoArray.get();
// clearance
while ( pUndoArray->aUndoActions.size() > pUndoArray->nCurUndoAction )
@@ -643,7 +643,7 @@ bool SfxUndoManager::ImplAddUndoAction_NoNotify( SfxUndoAction *pAction, bool bT
ImplClearRedo( i_guard, IUndoManager::CurrentLevel );
// respect max number
- if( m_xData->pActUndoArray == m_xData->pUndoArray )
+ if( m_xData->pActUndoArray == m_xData->pUndoArray.get() )
{
while(m_xData->pActUndoArray->aUndoActions.size() >= m_xData->pActUndoArray->nMaxUndoActions)
{
@@ -684,7 +684,7 @@ void SfxUndoManager::AddUndoAction( SfxUndoAction *pAction, bool bTryMerge )
size_t SfxUndoManager::GetUndoActionCount( bool const i_currentLevel ) const
{
UndoManagerGuard aGuard( *m_xData );
- const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : m_xData->pUndoArray;
+ const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : m_xData->pUndoArray.get();
return pUndoArray->nCurUndoAction;
}
@@ -694,7 +694,7 @@ OUString SfxUndoManager::GetUndoActionComment( size_t nNo, bool const i_currentL
UndoManagerGuard aGuard( *m_xData );
OUString sComment;
- const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : m_xData->pUndoArray;
+ const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : m_xData->pUndoArray.get();
assert(nNo < pUndoArray->nCurUndoAction);
if( nNo < pUndoArray->nCurUndoAction )
sComment = pUndoArray->aUndoActions[ pUndoArray->nCurUndoAction - 1 - nNo ].pAction->GetComment();
@@ -833,7 +833,7 @@ size_t SfxUndoManager::GetRedoActionCount( bool const i_currentLevel ) const
size_t SfxUndoManager::ImplGetRedoActionCount_Lock( bool const i_currentLevel ) const
{
- const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : m_xData->pUndoArray;
+ const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : m_xData->pUndoArray.get();
return pUndoArray->aUndoActions.size() - pUndoArray->nCurUndoAction;
}
@@ -855,7 +855,7 @@ OUString SfxUndoManager::GetRedoActionComment( size_t nNo, bool const i_currentL
{
OUString sComment;
UndoManagerGuard aGuard( *m_xData );
- const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : m_xData->pUndoArray;
+ const SfxUndoArray* pUndoArray = i_currentLevel ? m_xData->pActUndoArray : m_xData->pUndoArray.get();
if ( (pUndoArray->nCurUndoAction + nNo) < pUndoArray->aUndoActions.size() )
{
sComment = pUndoArray->aUndoActions[ pUndoArray->nCurUndoAction + nNo ].pAction->GetComment();
@@ -1038,7 +1038,7 @@ bool SfxUndoManager::IsInListAction() const
bool SfxUndoManager::ImplIsInListAction_Lock() const
{
- return ( m_xData->pActUndoArray != m_xData->pUndoArray );
+ return ( m_xData->pActUndoArray != m_xData->pUndoArray.get() );
}
@@ -1048,7 +1048,7 @@ size_t SfxUndoManager::GetListActionDepth() const
size_t nDepth(0);
SfxUndoArray* pLookup( m_xData->pActUndoArray );
- while ( pLookup != m_xData->pUndoArray )
+ while ( pLookup != m_xData->pUndoArray.get() )
{
pLookup = pLookup->pFatherUndoArray;
++nDepth;