diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-03-22 17:56:38 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-03-22 17:56:38 +0000 |
commit | 691cbc64250e18bfd9c7e02745b2ac4c35d87ea4 (patch) | |
tree | e87397f7151ac9e3ebde85212bc9346a4c633bd5 | |
parent | 43ceb40901d97773d729298a8cfedf37685fff99 (diff) |
coverity#704365 Logically dead code
Change-Id: I8981dfcd3f8c0fcf0ad84bbe87a6d40c1a1a49db
-rw-r--r-- | sw/source/core/unocore/unostyle.cxx | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 448b54858aa3..0c1f0a441bcb 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -863,38 +863,34 @@ void SwXStyleFamily::insertByName(const OUString& rName, const uno::Any& rElemen pNewStyle = reinterpret_cast< SwXStyle * >( sal::static_int_cast< sal_IntPtr >( xStyleTunnel->getSomething( SwXStyle::getUnoTunnelId()) )); } - if(!pNewStyle || !pNewStyle->IsDescriptor() || - pNewStyle->GetFamily() != eFamily) - throw lang::IllegalArgumentException(); - if(pNewStyle) - { - sal_uInt16 nMask = SFXSTYLEBIT_ALL; - if(eFamily == SFX_STYLE_FAMILY_PARA && !pNewStyle->IsConditional()) - nMask &= ~SWSTYLEBIT_CONDCOLL; + + if (!pNewStyle || !pNewStyle->IsDescriptor() || pNewStyle->GetFamily() != eFamily) + throw lang::IllegalArgumentException(); + + sal_uInt16 nMask = SFXSTYLEBIT_ALL; + if(eFamily == SFX_STYLE_FAMILY_PARA && !pNewStyle->IsConditional()) + nMask &= ~SWSTYLEBIT_CONDCOLL; #if OSL_DEBUG_LEVEL > 1 - SfxStyleSheetBase& rNewBase = + SfxStyleSheetBase& rNewBase = #endif - pBasePool->Make(sStyleName, eFamily, nMask); - pNewStyle->SetDoc(pDocShell->GetDoc(), pBasePool); - pNewStyle->SetStyleName(sStyleName); - const OUString sParentStyleName(pNewStyle->GetParentStyleName()); - if (!sParentStyleName.isEmpty()) - { - pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL ); - SfxStyleSheetBase* pParentBase = pBasePool->Find(sParentStyleName); - if(pParentBase && pParentBase->GetFamily() == eFamily && - &pParentBase->GetPool() == pBasePool) - pBasePool->SetParent( eFamily, sStyleName, sParentStyleName ); + pBasePool->Make(sStyleName, eFamily, nMask); + pNewStyle->SetDoc(pDocShell->GetDoc(), pBasePool); + pNewStyle->SetStyleName(sStyleName); + const OUString sParentStyleName(pNewStyle->GetParentStyleName()); + if (!sParentStyleName.isEmpty()) + { + pBasePool->SetSearchMask(eFamily, SFXSTYLEBIT_ALL ); + SfxStyleSheetBase* pParentBase = pBasePool->Find(sParentStyleName); + if(pParentBase && pParentBase->GetFamily() == eFamily && + &pParentBase->GetPool() == pBasePool) + pBasePool->SetParent( eFamily, sStyleName, sParentStyleName ); - } + } #if OSL_DEBUG_LEVEL > 1 - (void)rNewBase; + (void)rNewBase; #endif - //so, jetzt sollten noch die Properties des Descriptors angewandt werden - pNewStyle->ApplyDescriptorProperties(); - } - else - throw lang::IllegalArgumentException(); + //so, jetzt sollten noch die Properties des Descriptors angewandt werden + pNewStyle->ApplyDescriptorProperties(); } else throw lang::IllegalArgumentException(); |