diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-13 20:42:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-14 10:13:46 +0200 |
commit | 8e39ef66928a3e37c618d3a70a631e71266db274 (patch) | |
tree | 8cab0264e58c885ae7d78a77d90fd041bcdbe15d /sc | |
parent | d7e06e46acc2ee17101cef63e59b9f5efcbfab14 (diff) |
extend loplugin useuniqueptr to POD types
Change-Id: I6ff24f048bd8f75bf87a78b718f37b57855d4781
Reviewed-on: https://gerrit.libreoffice.org/39932
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/scmod.hxx | 8 | ||||
-rw-r--r-- | sc/source/ui/app/scmod.cxx | 1 | ||||
-rw-r--r-- | sc/source/ui/inc/undoblk.hxx | 6 | ||||
-rw-r--r-- | sc/source/ui/inc/undotab.hxx | 9 | ||||
-rw-r--r-- | sc/source/ui/undo/undoblk.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/undo/undotab.cxx | 9 |
6 files changed, 21 insertions, 20 deletions
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx index 6f24143fc2af..3a85539dbe69 100644 --- a/sc/inc/scmod.hxx +++ b/sc/inc/scmod.hxx @@ -29,9 +29,10 @@ #include "shellids.hxx" #include <unotools/options.hxx> -#include <map> -#include <list> #include <algorithm> +#include <list> +#include <map> +#include <memory> #include <stack> class KeyEvent; @@ -78,7 +79,8 @@ class ScModule: public SfxModule, public SfxListener, public utl::ConfigurationL Timer aIdleTimer; Idle aSpellIdle; ScDragData* mpDragData; - ScClipData* mpClipData; + std::unique_ptr<ScClipData> + mpClipData; ScSelectionTransferObj* pSelTransfer; ScMessagePool* pMessagePool; // there is no global InputHandler anymore, each View has it's own diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index b5b314f4df20..e14cf65c7cf7 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -207,7 +207,6 @@ ScModule::~ScModule() DELETEZ( pFormEditData ); delete mpDragData; - delete mpClipData; delete pErrorHdl; ScGlobal::Clear(); // Also calls ScDocumentPool::DeleteVersionMaps(); diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx index 9b89e55a2fde..dca1045ee5a0 100644 --- a/sc/source/ui/inc/undoblk.hxx +++ b/sc/source/ui/inc/undoblk.hxx @@ -905,8 +905,10 @@ public: private: ScMarkData aMarkData; - ScDocument* pUndoDoc; - sal_uInt16* pWhich; + std::unique_ptr<ScDocument> + pUndoDoc; + std::unique_ptr<sal_uInt16[]> + pWhich; }; class ScUndoRemoveBreaks: public ScSimpleUndo diff --git a/sc/source/ui/inc/undotab.hxx b/sc/source/ui/inc/undotab.hxx index 5585e2d3e9b8..477ac208a969 100644 --- a/sc/source/ui/inc/undotab.hxx +++ b/sc/source/ui/inc/undotab.hxx @@ -296,9 +296,12 @@ private: OUString aOptions; sal_uLong nRefreshDelay; sal_uInt16 nCount; - SCTAB* pTabs; - ScLinkMode* pModes; - OUString* pTabNames; + std::unique_ptr<SCTAB[]> + pTabs; + std::unique_ptr<ScLinkMode[]> + pModes; + std::unique_ptr<OUString[]> + pTabNames; void DoChange( bool bLink ) const; }; diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index 4696623ead07..f4ad5170139a 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -2042,15 +2042,13 @@ ScUndoClearItems::ScUndoClearItems( ScDocShell* pNewDocShell, const ScMarkData& sal_uInt16 nCount = 0; while ( pW[nCount] ) ++nCount; - pWhich = new sal_uInt16[nCount+1]; + pWhich.reset( new sal_uInt16[nCount+1] ); for (sal_uInt16 i=0; i<=nCount; i++) pWhich[i] = pW[i]; } ScUndoClearItems::~ScUndoClearItems() { - delete pUndoDoc; - delete pWhich; } OUString ScUndoClearItems::GetComment() const @@ -2074,7 +2072,7 @@ void ScUndoClearItems::Redo() BeginRedo(); ScDocument& rDoc = pDocShell->GetDocument(); - rDoc.ClearSelectionItems( pWhich, aMarkData ); + rDoc.ClearSelectionItems( pWhich.get(), aMarkData ); pDocShell->PostPaint( aBlockRange, PaintPartFlags::Grid, SC_PF_LINES | SC_PF_TESTMERGE ); EndRedo(); @@ -2085,7 +2083,7 @@ void ScUndoClearItems::Repeat(SfxRepeatTarget& rTarget) if (dynamic_cast<const ScTabViewTarget*>( &rTarget) != nullptr) { ScViewData& rViewData = static_cast<ScTabViewTarget&>(rTarget).GetViewShell()->GetViewData(); - rViewData.GetDocFunc().ClearItems( rViewData.GetMarkData(), pWhich, false ); + rViewData.GetDocFunc().ClearItems( rViewData.GetMarkData(), pWhich.get(), false ); } } diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx index 67d7eee929b1..f3dc9aa6fe5d 100644 --- a/sc/source/ui/undo/undotab.cxx +++ b/sc/source/ui/undo/undotab.cxx @@ -1018,9 +1018,9 @@ ScUndoRemoveLink::ScUndoRemoveLink( ScDocShell* pShell, const OUString& rDocName { ScDocument& rDoc = pDocShell->GetDocument(); SCTAB nTabCount = rDoc.GetTableCount(); - pTabs = new SCTAB[nTabCount]; - pModes = new ScLinkMode[nTabCount]; - pTabNames = new OUString[nTabCount]; + pTabs.reset( new SCTAB[nTabCount] ); + pModes.reset( new ScLinkMode[nTabCount] ); + pTabNames.reset( new OUString[nTabCount] ); for (SCTAB i=0; i<nTabCount; i++) { @@ -1050,9 +1050,6 @@ ScUndoRemoveLink::ScUndoRemoveLink( ScDocShell* pShell, const OUString& rDocName ScUndoRemoveLink::~ScUndoRemoveLink() { - delete pTabs; - delete pModes; - delete[] pTabNames; } OUString ScUndoRemoveLink::GetComment() const |