diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-06 09:46:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-04-06 09:22:46 +0000 |
commit | aa09b0c27a6d925da428d6267daadc7338829869 (patch) | |
tree | b0fa576ff64820061d9fb876bebacd23e58ddc56 /sc/source/ui/docshell/impex.cxx | |
parent | 0c82dff153d92150729815b919854a9a350aa031 (diff) |
loplugin:useuniqueptr extend to catch more localvar cases
i.e. where the code looks like
{
foo * p = new foo;
...
delete p;
return ...;
}
Change-Id: Id5f2e55d0363fc62c72535a23faeaaf1f0ac6aee
Reviewed-on: https://gerrit.libreoffice.org/36190
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/docshell/impex.cxx')
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index f0ab4dd1c006..47ea37a8dc8d 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -2130,11 +2130,11 @@ bool ScImportExport::Doc2Dif( SvStream& rStrm ) bool ScImportExport::Dif2Doc( SvStream& rStrm ) { SCTAB nTab = aRange.aStart.Tab(); - ScDocument* pImportDoc = new ScDocument( SCDOCMODE_UNDO ); + std::unique_ptr<ScDocument> pImportDoc( new ScDocument( SCDOCMODE_UNDO ) ); pImportDoc->InitUndo( pDoc, nTab, nTab ); // for DIF in the clipboard, IBM_850 is always used - ScFormatFilter::Get().ScImportDif( rStrm, pImportDoc, aRange.aStart, RTL_TEXTENCODING_IBM_850 ); + ScFormatFilter::Get().ScImportDif( rStrm, pImportDoc.get(), aRange.aStart, RTL_TEXTENCODING_IBM_850 ); SCCOL nEndCol; SCROW nEndRow; @@ -2155,8 +2155,6 @@ bool ScImportExport::Dif2Doc( SvStream& rStrm ) EndPaste(); } - delete pImportDoc; - return bOk; } |