diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-28 10:33:09 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-29 08:51:48 +0200 |
commit | 1ffba0e356608fb6dbf568248e2a953b4d7fb5d6 (patch) | |
tree | 5da59640441292421f2137bc85ee7291daed137e /svx | |
parent | ce9a41dc387966c74c1af92783a97565b5af3668 (diff) |
loplugin:flatten check for throw in then clause
also make the plugin ignore the case where we have var decl's in the
clause we want to flatten, which could lead to problematic extension of
variable lifetime
Change-Id: I3061f7104e8c6a460bf74f5eac325a516ec50c59
Reviewed-on: https://gerrit.libreoffice.org/42889
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/unodraw/unoshap3.cxx | 38 | ||||
-rw-r--r-- | svx/source/unogallery/unogaltheme.cxx | 12 | ||||
-rw-r--r-- | svx/source/unogallery/unogalthemeprovider.cxx | 12 |
3 files changed, 26 insertions, 36 deletions
diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx index a9604f6b766e..d1e3ff9d2cb0 100644 --- a/svx/source/unodraw/unoshap3.cxx +++ b/svx/source/unodraw/unoshap3.cxx @@ -154,28 +154,26 @@ void SAL_CALL Svx3DSceneObject::remove( const Reference< drawing::XShape >& xSha { throw uno::RuntimeException(); } - else - { - SdrObjList& rList = *pSdrShape->GetObjList(); - const size_t nObjCount = rList.GetObjCount(); - size_t nObjNum = 0; - while( nObjNum < nObjCount ) - { - if(rList.GetObj( nObjNum ) == pSdrShape ) - break; - nObjNum++; - } + SdrObjList& rList = *pSdrShape->GetObjList(); - if( nObjNum < nObjCount ) - { - SdrObject* pObject = rList.NbcRemoveObject( nObjNum ); - SdrObject::Free( pObject ); - } - else - { - SAL_WARN( "svx", "Fatality! SdrObject is not belonging to its SdrObjList! [CL]" ); - } + const size_t nObjCount = rList.GetObjCount(); + size_t nObjNum = 0; + while( nObjNum < nObjCount ) + { + if(rList.GetObj( nObjNum ) == pSdrShape ) + break; + nObjNum++; + } + + if( nObjNum < nObjCount ) + { + SdrObject* pObject = rList.NbcRemoveObject( nObjNum ); + SdrObject::Free( pObject ); + } + else + { + SAL_WARN( "svx", "Fatality! SdrObject is not belonging to its SdrObjList! [CL]" ); } } diff --git a/svx/source/unogallery/unogaltheme.cxx b/svx/source/unogallery/unogaltheme.cxx index f035bc174b22..f1d53c8f2aa7 100644 --- a/svx/source/unogallery/unogaltheme.cxx +++ b/svx/source/unogallery/unogaltheme.cxx @@ -135,13 +135,10 @@ uno::Any SAL_CALL GalleryTheme::getByIndex( ::sal_Int32 nIndex ) { throw lang::IndexOutOfBoundsException(); } - else - { - const GalleryObject* pObj = mpTheme->ImplGetGalleryObject( nIndex ); + const GalleryObject* pObj = mpTheme->ImplGetGalleryObject( nIndex ); - if( pObj ) - aRet <<= uno::Reference< gallery::XGalleryItem >( new GalleryItem( *this, *pObj ) ); - } + if( pObj ) + aRet <<= uno::Reference< gallery::XGalleryItem >( new GalleryItem( *this, *pObj ) ); } return aRet; @@ -291,8 +288,7 @@ void SAL_CALL GalleryTheme::removeByIndex( sal_Int32 nIndex ) { if( ( nIndex < 0 ) || ( nIndex >= getCount() ) ) throw lang::IndexOutOfBoundsException(); - else - mpTheme->RemoveObject( nIndex ); + mpTheme->RemoveObject( nIndex ); } } diff --git a/svx/source/unogallery/unogalthemeprovider.cxx b/svx/source/unogallery/unogalthemeprovider.cxx index f11dcb279331..c497a86d830e 100644 --- a/svx/source/unogallery/unogalthemeprovider.cxx +++ b/svx/source/unogallery/unogalthemeprovider.cxx @@ -166,10 +166,8 @@ uno::Any SAL_CALL GalleryThemeProvider::getByName( const OUString& rName ) { throw container::NoSuchElementException(); } - else - { - aRet <<= uno::Reference< gallery::XGalleryTheme >( new ::unogallery::GalleryTheme( rName ) ); - } + + aRet <<= uno::Reference< gallery::XGalleryTheme >( new ::unogallery::GalleryTheme( rName ) ); return aRet; } @@ -239,10 +237,8 @@ void SAL_CALL GalleryThemeProvider::removeByName( const OUString& rName ) { throw container::NoSuchElementException(); } - else - { - mpGallery->RemoveTheme( rName ); - } + + mpGallery->RemoveTheme( rName ); } } |