diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-11-12 17:07:22 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-11-14 08:52:21 +0000 |
commit | aa3f954222a270d3e2fa531badd2fa7febd30338 (patch) | |
tree | f9921a240795044f00ce61718d052c26ebbc8ae0 /sc/source/ui/drawfunc/fusel.cxx | |
parent | 90a77e9c13eb9b2aa6e83653d9d2d1409bc47f36 (diff) |
coverity#703927 Unchecked return value
make these less odd and simply return the thing they selected, rather than a
bool that indicates that the rpObj arg was successfully set to non-null, so
there's one flag to check not two which both mean the same thing.
Change-Id: If70e412f98dea8b7114fb77f26a9c59aab93be50
Reviewed-on: https://gerrit.libreoffice.org/30794
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui/drawfunc/fusel.cxx')
-rw-r--r-- | sc/source/ui/drawfunc/fusel.cxx | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx index aa0ff4b41bdd..445ac52c058a 100644 --- a/sc/source/ui/drawfunc/fusel.cxx +++ b/sc/source/ui/drawfunc/fusel.cxx @@ -143,10 +143,10 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt) } else { - SdrObject* pObj; - SdrPageView* pPV; + SdrPageView* pPV = nullptr; bool bAlt = rMEvt.IsMod2(); - if ( !bAlt && pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SdrSearchOptions::PICKMACRO) ) + SdrObject* pObj = !bAlt ? pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::PICKMACRO) : nullptr; + if (pObj) { pView->BegMacroObj(aMDPos, pObj, pPV, pWindow); bReturn = true; @@ -154,7 +154,8 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt) else { OUString sURL, sTarget; - if ( !bAlt && pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER)) + pObj = !bAlt ? pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER) : nullptr; + if (pObj) { // Support for imported Excel docs // Excel is of course not consistent and allows @@ -176,8 +177,8 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt) ScMacroInfo* pTmpInfo = ScDrawLayer::GetMacroInfo( pObj ); if ( !pTmpInfo || pTmpInfo->GetMacro().isEmpty() ) { - SdrObject* pHit = nullptr; - if ( pView->PickObj(aMDPos, pView->getHitTolLog(), pHit, pPV, SdrSearchOptions::DEEP ) ) + SdrObject* pHit = pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::DEEP); + if (pHit) pObj = pHit; } } @@ -420,7 +421,8 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) * one, he releases the mouse button immediately **************************************************************/ SdrPageView* pPV = nullptr; - if (pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK)) + pObj = pView->PickObj(aMDPos, pView->getHitTolLog(), pPV, SdrSearchOptions::ALSOONMASTER | SdrSearchOptions::BEFOREMARK); + if (pObj) { pView->UnmarkAllObj(); pView->MarkObj(pObj,pPV); |