diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-12-16 19:05:51 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-12-17 14:27:32 +0100 |
commit | 228105d870705878f366ca5b9a559662f2a840cb (patch) | |
tree | ab249b6bcc80d94d7f7e75bf584f5809a832bac2 /sw | |
parent | 2f9360b58a358fefb86f474464e53f1ea5ffb52b (diff) |
coverity#1426169 refactor to be less obscure
and coverity#1426166
no logic changes intended
Change-Id: I241f3f09c6a4ab143b67eb9341e8a52acbae64e3
a026f03980fdf1c80d1c6cffbd8ad0325c8f5d02
Reviewed-on: https://gerrit.libreoffice.org/46619
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 'sw')
-rw-r--r-- | sw/source/core/layout/flycnt.cxx | 25 | ||||
-rw-r--r-- | sw/source/core/layout/flylay.cxx | 25 |
2 files changed, 28 insertions, 22 deletions
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 20c891af939a..7924e788b621 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -77,20 +77,23 @@ SwFlyAtContentFrame::SwFlyAtContentFrame( SwFlyFrameFormat *pFormat, SwFrame* pS void SwFlyAtContentFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) { - const sal_uInt16 nWhich = pNew ? pNew->Which() : 0; const SwFormatAnchor *pAnch = nullptr; - if( RES_ATTRSET_CHG == nWhich && SfxItemState::SET == - static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_ANCHOR, false, - reinterpret_cast<const SfxPoolItem**>(&pAnch) )) - ; // The anchor pointer is set at GetItemState! - - else if( RES_ANCHOR == nWhich ) + if (pNew) { - //Change anchor, I move myself to a new place. - //The anchor type must not change, this is only possible using - //SwFEShell. - pAnch = static_cast<const SwFormatAnchor*>(pNew); + const sal_uInt16 nWhich = pNew->Which(); + if( RES_ATTRSET_CHG == nWhich && SfxItemState::SET == + static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_ANCHOR, false, + reinterpret_cast<const SfxPoolItem**>(&pAnch) )) + ; // The anchor pointer is set at GetItemState! + + else if( RES_ANCHOR == nWhich ) + { + //Change anchor, I move myself to a new place. + //The anchor type must not change, this is only possible using + //SwFEShell. + pAnch = static_cast<const SwFormatAnchor*>(pNew); + } } if( pAnch ) diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 8a3af6c27006..92342f5928f6 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -713,20 +713,23 @@ SwFlyLayFrame::SwFlyLayFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame void SwFlyLayFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) { - const sal_uInt16 nWhich = pNew ? pNew->Which() : 0; - const SwFormatAnchor *pAnch = nullptr; - if( RES_ATTRSET_CHG == nWhich && SfxItemState::SET == - static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_ANCHOR, false, - reinterpret_cast<const SfxPoolItem**>(&pAnch) )) - ; // GetItemState sets the anchor pointer! - else if( RES_ANCHOR == nWhich ) + if (pNew) { - // Change of anchor. I'm attaching myself to the new place. - // It's not allowed to change the anchor type. This is only - // possible via SwFEShell. - pAnch = static_cast<const SwFormatAnchor*>(pNew); + const sal_uInt16 nWhich = pNew ? pNew->Which() : 0; + if( RES_ATTRSET_CHG == nWhich && SfxItemState::SET == + static_cast<const SwAttrSetChg*>(pNew)->GetChgSet()->GetItemState( RES_ANCHOR, false, + reinterpret_cast<const SfxPoolItem**>(&pAnch) )) + ; // GetItemState sets the anchor pointer! + + else if( RES_ANCHOR == nWhich ) + { + // Change of anchor. I'm attaching myself to the new place. + // It's not allowed to change the anchor type. This is only + // possible via SwFEShell. + pAnch = static_cast<const SwFormatAnchor*>(pNew); + } } if( pAnch ) |