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 /sd/source/ui/view | |
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 'sd/source/ui/view')
-rw-r--r-- | sd/source/ui/view/sdview2.cxx | 12 | ||||
-rw-r--r-- | sd/source/ui/view/sdview3.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/view/sdview4.cxx | 2 |
3 files changed, 8 insertions, 11 deletions
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index 8b6c079989a7..ccdf2ada88f6 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -536,14 +536,13 @@ sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTarge // check object insert if( !nRet && ( bXFillExchange || ( ( bDrawing || bGraphic || bMtf || bBitmap || bBookmark ) && ( nDropAction & DND_ACTION_LINK ) ) ) ) { - SdrObject* pPickObj = nullptr; SdrPageView* pPageView = nullptr; ::sd::Window* pWindow = mpViewSh->GetActiveWindow(); Point aPos( pWindow->PixelToLogic( rEvt.maPosPixel ) ); - const bool bHasPickObj = PickObj( aPos, getHitTolLog(), pPickObj, pPageView ); + SdrObject* pPickObj = PickObj(aPos, getHitTolLog(), pPageView); bool bIsPresTarget = false; - if( bHasPickObj && pPickObj && ( pPickObj->IsEmptyPresObj() || pPickObj->GetUserCall() ) ) + if (pPickObj && (pPickObj->IsEmptyPresObj() || pPickObj->GetUserCall())) { SdPage* pPage = static_cast<SdPage*>( pPickObj->GetPage() ); @@ -551,8 +550,7 @@ sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTarge bIsPresTarget = pPage->IsPresObj( pPickObj ); } - if( bHasPickObj && !bIsPresTarget && - ( bGraphic || bMtf || bBitmap || bXFillExchange ) ) + if (pPickObj && !bIsPresTarget && (bGraphic || bMtf || bBitmap || bXFillExchange)) { if( mpDropMarkerObj != pPickObj ) { @@ -719,10 +717,10 @@ sal_Int8 View::ExecuteDrop( const ExecuteDropEvent& rEvt, } else { - SdrObject* pPickObj = nullptr; SdrPageView* pPageView = nullptr; - if( PickObj( aPos, getHitTolLog(), pPickObj, pPageView ) ) + SdrObject* pPickObj = PickObj(aPos, getHitTolLog(), pPageView); + if (pPickObj) { // insert as clip action => jump OUString aBookmark( aINetBookmark.GetURL() ); diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index ed2b16c4ed03..6490032b32c9 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -286,7 +286,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, if( bDrag ) { SdrPageView* pPV = nullptr; - PickObj( rPos, getHitTolLog(), pPickObj, pPV ); + pPickObj = PickObj(rPos, getHitTolLog(), pPV); } if( nPage != SDRPAGE_NOTFOUND ) @@ -706,9 +706,8 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, { // only one object SdrObject* pObj = pModel->GetSdPage( 0, PageKind::Standard )->GetObj( 0 ); - SdrObject* pPickObj2 = nullptr; SdrPageView* pPV = nullptr; - PickObj( rPos, getHitTolLog(), pPickObj2, pPV ); + SdrObject* pPickObj2 = PickObj(rPos, getHitTolLog(), pPV); if( ( mnAction & DND_ACTION_MOVE ) && pPickObj2 && pObj ) { diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 7782139d604e..96a2ffc5363c 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -95,7 +95,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, if( !pPickObj && pPV ) { SdrPageView* pPageView = pPV; - PickObj(rPos, getHitTolLog(), pPickObj, pPageView); + pPickObj = PickObj(rPos, getHitTolLog(), pPageView); } const bool bIsGraphic(dynamic_cast< const SdrGrafObj* >(pPickObj) != nullptr); |