diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-10-14 09:57:55 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-10-14 10:59:45 +0100 |
commit | 0087fb06dce8e705293434df67409786143c2a59 (patch) | |
tree | c596b15b8cc12d6e9b4eb9bd758e49d3fe68baac /sw | |
parent | b7f9175ec4bb48a420a42f35908ac3e514d36fd5 (diff) |
coverity#735968 Unchecked dynamic_cast
Change-Id: Idf9b26180f824321bd5e07e9a9360bb9e59472dd
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/xml/xmlimpit.cxx | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx index 38e4ad545594..71cede038fde 100644 --- a/sw/source/filter/xml/xmlimpit.cxx +++ b/sw/source/filter/xml/xmlimpit.cxx @@ -229,16 +229,16 @@ struct BoxHolder : private boost::noncopyable SvxBorderLine* pLeft; SvxBorderLine* pRight; - explicit BoxHolder(SvxBoxItem* pBox) + explicit BoxHolder(SvxBoxItem& rBox) { - pTop = pBox->GetTop() == NULL ? - NULL : new SvxBorderLine( *pBox->GetTop() ); - pBottom = pBox->GetBottom() == NULL ? - NULL : new SvxBorderLine( *pBox->GetBottom() ); - pLeft = pBox->GetLeft() == NULL ? - NULL : new SvxBorderLine( *pBox->GetLeft() ); - pRight = pBox->GetRight() == NULL ? - NULL : new SvxBorderLine( *pBox->GetRight() ); + pTop = rBox.GetTop() == NULL ? + NULL : new SvxBorderLine( *rBox.GetTop() ); + pBottom = rBox.GetBottom() == NULL ? + NULL : new SvxBorderLine( *rBox.GetBottom() ); + pLeft = rBox.GetLeft() == NULL ? + NULL : new SvxBorderLine( *rBox.GetLeft() ); + pRight = rBox.GetRight() == NULL ? + NULL : new SvxBorderLine( *rBox.GetRight() ); } ~BoxHolder() @@ -433,11 +433,10 @@ bool SvXMLImportItemMapper::PutXMLValue( case RES_BOX: { - SvxBoxItem* pBox = dynamic_cast<SvxBoxItem*>( &rItem ); - OSL_ENSURE( pBox != NULL, "Wrong WHich-ID" ); + SvxBoxItem& rBox = dynamic_cast<SvxBoxItem&>(rItem); // copy SvxBorderLines - BoxHolder aBoxes(pBox); + BoxHolder aBoxes(rBox); sal_Int32 nTemp; @@ -456,16 +455,16 @@ bool SvXMLImportItemMapper::PutXMLValue( if( nMemberId == LEFT_BORDER_PADDING || nMemberId == ALL_BORDER_PADDING ) - pBox->SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::LEFT ); + rBox.SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::LEFT ); if( nMemberId == RIGHT_BORDER_PADDING || nMemberId == ALL_BORDER_PADDING ) - pBox->SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::RIGHT ); + rBox.SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::RIGHT ); if( nMemberId == TOP_BORDER_PADDING || nMemberId == ALL_BORDER_PADDING ) - pBox->SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::TOP ); + rBox.SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::TOP ); if( nMemberId == BOTTOM_BORDER_PADDING || nMemberId == ALL_BORDER_PADDING ) - pBox->SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::BOTTOM); + rBox.SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::BOTTOM); break; case ALL_BORDER: @@ -578,10 +577,10 @@ bool SvXMLImportItemMapper::PutXMLValue( break; } - pBox->SetLine( aBoxes.pTop, SvxBoxItemLine::TOP ); - pBox->SetLine( aBoxes.pBottom, SvxBoxItemLine::BOTTOM ); - pBox->SetLine( aBoxes.pLeft, SvxBoxItemLine::LEFT ); - pBox->SetLine( aBoxes.pRight, SvxBoxItemLine::RIGHT ); + rBox.SetLine( aBoxes.pTop, SvxBoxItemLine::TOP ); + rBox.SetLine( aBoxes.pBottom, SvxBoxItemLine::BOTTOM ); + rBox.SetLine( aBoxes.pLeft, SvxBoxItemLine::LEFT ); + rBox.SetLine( aBoxes.pRight, SvxBoxItemLine::RIGHT ); bOk = true; } |