diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-08-25 11:09:38 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-10-21 10:36:39 +0200 |
commit | e26f8d2592a3d7cc5b43b3246b364397dd704f0d (patch) | |
tree | 8677f333ba26a23f2999ab3a083696a8d2e29b74 /sc/source/ui/docshell | |
parent | 3dce7bd77c56e61cd9457b03e8cf4137a7630eb9 (diff) |
coverity#1401307 document checked 'Uncaught exception'
markup std::unique_ptr where coverity warns a dtor might throw exceptions which
won't throw in practice, or where std::terminate is an acceptable response if
they do
Change-Id: Icc99cdecf8d8b011e599574f0a05b59efd1c65c2
Reviewed-on: https://gerrit.libreoffice.org/41561
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui/docshell')
-rw-r--r-- | sc/source/ui/docshell/dbdocfun.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/docshell/docfuncutil.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/docshell/documentlinkmgr.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 2 |
5 files changed, 16 insertions, 16 deletions
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 96fc5982fc13..0bb9aa4fed3b 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -1157,7 +1157,7 @@ bool isEditable(ScDocShell& rDocShell, const ScRangeList& rRanges, bool bApi) return true; } -void createUndoDoc(std::unique_ptr<ScDocument>& pUndoDoc, ScDocument* pDoc, const ScRange& rRange) +void createUndoDoc(ScDocumentUniquePtr& pUndoDoc, ScDocument* pDoc, const ScRange& rRange) { SCTAB nTab = rRange.aStart.Tab(); pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO)); @@ -1241,8 +1241,8 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb if (!isEditable(rDocShell, aRanges, bApi)) return false; - std::unique_ptr<ScDocument> pOldUndoDoc; - std::unique_ptr<ScDocument> pNewUndoDoc; + ScDocumentUniquePtr pOldUndoDoc; + ScDocumentUniquePtr pNewUndoDoc; ScDPObject aUndoDPObj(*pOldObj); // for undo or revert on failure @@ -1352,7 +1352,7 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi) } } - std::unique_ptr<ScDocument> pOldUndoDoc; + ScDocumentUniquePtr pOldUndoDoc; std::unique_ptr<ScDPObject> pUndoDPObj; if (bRecord) @@ -1403,7 +1403,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool if (!isEditable(rDocShell, ScRange(rDPObj.GetOutRange().aStart), bApi)) return false; - std::unique_ptr<ScDocument> pNewUndoDoc; + ScDocumentUniquePtr pNewUndoDoc; ScDocument& rDoc = rDocShell.GetDocument(); if (bRecord && !rDoc.IsUndoEnabled()) @@ -1516,8 +1516,8 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi) if (!isEditable(rDocShell, rDPObj.GetOutRange(), bApi)) return false; - std::unique_ptr<ScDocument> pOldUndoDoc; - std::unique_ptr<ScDocument> pNewUndoDoc; + ScDocumentUniquePtr pOldUndoDoc; + ScDocumentUniquePtr pNewUndoDoc; ScDPObject aUndoDPObj(rDPObj); // For undo or revert on failure. diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 8cdfa9f12de8..dfbc54582c6b 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -583,7 +583,7 @@ bool ScDocFunc::DeleteContents( ScMarkData aMultiMark = rMark; aMultiMark.SetMarking(false); // for MarkToMulti - std::unique_ptr<ScDocument> pUndoDoc; + ScDocumentUniquePtr pUndoDoc; bool bMulti = aMultiMark.IsMultiMarked(); aMultiMark.MarkToMulti(); aMultiMark.GetMultiMarkArea( aMarkRange ); @@ -688,7 +688,7 @@ bool ScDocFunc::DeleteCell( // To keep track of all non-empty cells within the deleted area. std::shared_ptr<ScSimpleUndo::DataSpansType> pDataSpans; - std::unique_ptr<ScDocument> pUndoDoc; + ScDocumentUniquePtr pUndoDoc; if (bRecord) { pUndoDoc = sc::DocFuncUtil::createDeleteContentsUndoDoc(rDoc, rMark, rPos, nFlags, false); @@ -2737,7 +2737,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, SCTAB nDestEndTab = nDestTab+nSrcTabCount-1; SCTAB nTab; - std::unique_ptr<ScDocument> pClipDoc = o3tl::make_unique<ScDocument>(SCDOCMODE_CLIP); + ScDocumentUniquePtr pClipDoc(new ScDocument(SCDOCMODE_CLIP)); ScMarkData aSourceMark; for (nTab=nStartTab; nTab<=nEndTab; nTab++) diff --git a/sc/source/ui/docshell/docfuncutil.cxx b/sc/source/ui/docshell/docfuncutil.cxx index 1eede21b952d..f00fa56608fb 100644 --- a/sc/source/ui/docshell/docfuncutil.cxx +++ b/sc/source/ui/docshell/docfuncutil.cxx @@ -42,11 +42,11 @@ bool DocFuncUtil::hasProtectedTab( const ScDocument& rDoc, const ScMarkData& rMa return false; } -std::unique_ptr<ScDocument> DocFuncUtil::createDeleteContentsUndoDoc( +ScDocumentUniquePtr DocFuncUtil::createDeleteContentsUndoDoc( ScDocument& rDoc, const ScMarkData& rMark, const ScRange& rRange, InsertDeleteFlags nFlags, bool bOnlyMarked ) { - std::unique_ptr<ScDocument> pUndoDoc(new ScDocument(SCDOCMODE_UNDO)); + ScDocumentUniquePtr pUndoDoc(new ScDocument(SCDOCMODE_UNDO)); SCTAB nTab = rRange.aStart.Tab(); pUndoDoc->InitUndo(&rDoc, nTab, nTab); SCTAB nTabCount = rDoc.GetTableCount(); @@ -76,7 +76,7 @@ std::unique_ptr<ScDocument> DocFuncUtil::createDeleteContentsUndoDoc( void DocFuncUtil::addDeleteContentsUndo( svl::IUndoManager* pUndoMgr, ScDocShell* pDocSh, const ScMarkData& rMark, - const ScRange& rRange, std::unique_ptr<ScDocument>&& pUndoDoc, InsertDeleteFlags nFlags, + const ScRange& rRange, ScDocumentUniquePtr&& pUndoDoc, InsertDeleteFlags nFlags, const std::shared_ptr<ScSimpleUndo::DataSpansType>& pSpans, bool bMulti, bool bDrawUndo ) { diff --git a/sc/source/ui/docshell/documentlinkmgr.cxx b/sc/source/ui/docshell/documentlinkmgr.cxx index c8ba3a48b6d4..aa508dca8ef0 100644 --- a/sc/source/ui/docshell/documentlinkmgr.cxx +++ b/sc/source/ui/docshell/documentlinkmgr.cxx @@ -22,7 +22,7 @@ #include <ddelink.hxx> #include <strings.hrc> #include <scresid.hxx> - +#include <o3tl/deleter.hxx> #include <svx/svdoole2.hxx> #include <vcl/layout.hxx> @@ -33,7 +33,7 @@ namespace sc { struct DocumentLinkManagerImpl { SfxObjectShell* mpShell; - std::unique_ptr<DataStream> mpDataStream; + std::unique_ptr<DataStream, o3tl::default_delete<DataStream>> mpDataStream; std::unique_ptr<sfx2::LinkManager> mpLinkManager; DocumentLinkManagerImpl(const DocumentLinkManagerImpl&) = delete; diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 3fe47e3ef4ee..7a6dca99ad89 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -2152,7 +2152,7 @@ bool ScImportExport::Doc2Dif( SvStream& rStrm ) bool ScImportExport::Dif2Doc( SvStream& rStrm ) { SCTAB nTab = aRange.aStart.Tab(); - std::unique_ptr<ScDocument> pImportDoc( new ScDocument( SCDOCMODE_UNDO ) ); + ScDocumentUniquePtr pImportDoc( new ScDocument( SCDOCMODE_UNDO ) ); pImportDoc->InitUndo( pDoc, nTab, nTab ); // for DIF in the clipboard, IBM_850 is always used |