[Libreoffice-commits] core.git: 2 commits - sw/source
Michael Stahl
mstahl at redhat.com
Tue Feb 10 08:08:45 PST 2015
sw/source/core/crsr/trvltbl.cxx | 2 -
sw/source/core/layout/pagechg.cxx | 45 +++++++++++++++++---------------------
2 files changed, 21 insertions(+), 26 deletions(-)
New commits:
commit d285f273adf35acc21ac6659523b28b3321b49ae
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Feb 10 16:53:22 2015 +0100
coverity#1267646 coverity#1267641: sw: logically dead code
... in SwPageFrm::_UpdateAttr()
It looks like SwFmtChg always is sent in pairs and shouldn't contain
null pointers.
Change-Id: Ib14650d5ac7ed579af915806e738aec8a92add32
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 0f677c5..ceb3269 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -534,33 +534,30 @@ void SwPageFrm::_UpdateAttr( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
// If the frame format is changed, several things might also change:
// 1. columns:
assert(pOld && pNew); //FMT_CHG Missing Format
- const SwFmt* pOldFmt = pOld ? static_cast<const SwFmtChg*>(pOld)->pChangedFmt : NULL;
- const SwFmt* pNewFmt = pNew ? static_cast<const SwFmtChg*>(pNew)->pChangedFmt : NULL;
+ const SwFmt *const pOldFmt = static_cast<const SwFmtChg*>(pOld)->pChangedFmt;
+ const SwFmt *const pNewFmt = static_cast<const SwFmtChg*>(pNew)->pChangedFmt;
assert(pOldFmt && pNewFmt); //FMT_CHG Missing Format
- if (pOldFmt && pNewFmt)
+ const SwFmtCol &rOldCol = pOldFmt->GetCol();
+ const SwFmtCol &rNewCol = pNewFmt->GetCol();
+ if( rOldCol != rNewCol )
{
- const SwFmtCol &rOldCol = pOldFmt->GetCol();
- const SwFmtCol &rNewCol = pNewFmt->GetCol();
- if( rOldCol != rNewCol )
- {
- SwLayoutFrm *pB = FindBodyCont();
- OSL_ENSURE( pB, "Seite ohne Body." );
- pB->ChgColumns( rOldCol, rNewCol );
- rInvFlags |= 0x20;
- }
-
- // 2. header and footer:
- const SwFmtHeader &rOldH = pOldFmt->GetHeader();
- const SwFmtHeader &rNewH = pNewFmt->GetHeader();
- if( rOldH != rNewH )
- rInvFlags |= 0x08;
-
- const SwFmtFooter &rOldF = pOldFmt->GetFooter();
- const SwFmtFooter &rNewF = pNewFmt->GetFooter();
- if( rOldF != rNewF )
- rInvFlags |= 0x10;
- CheckDirChange();
+ SwLayoutFrm *pB = FindBodyCont();
+ OSL_ENSURE( pB, "Seite ohne Body." );
+ pB->ChgColumns( rOldCol, rNewCol );
+ rInvFlags |= 0x20;
}
+
+ // 2. header and footer:
+ const SwFmtHeader &rOldH = pOldFmt->GetHeader();
+ const SwFmtHeader &rNewH = pNewFmt->GetHeader();
+ if( rOldH != rNewH )
+ rInvFlags |= 0x08;
+
+ const SwFmtFooter &rOldF = pOldFmt->GetFooter();
+ const SwFmtFooter &rNewF = pNewFmt->GetFooter();
+ if( rOldF != rNewF )
+ rInvFlags |= 0x10;
+ CheckDirChange();
}
// no break
case RES_FRM_SIZE:
commit 9665911b79b75a82d1c287826087c717b8158976
Author: Michael Stahl <mstahl at redhat.com>
Date: Tue Feb 10 16:30:57 2015 +0100
coverity#1267654: sw: logically dead code in SwCrsrShell::GoNextCell()
IsTableMode() should imply cursor is in table.
Change-Id: Ibb94911430f947038abba2ebe013fc82fae7dd54
diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx
index fd0d20c..4b46c98 100644
--- a/sw/source/core/crsr/trvltbl.cxx
+++ b/sw/source/core/crsr/trvltbl.cxx
@@ -65,8 +65,6 @@ bool SwCrsrShell::GoNextCell( bool bAppendLine )
if ( !pTblNd )
pTblNd = IsCrsrInTbl();
assert (pTblNd);
- if (!pTblNd)
- return false;
pTableBox = & pTableBox->FindEndOfRowSpan( pTblNd->GetTable(),
(sal_uInt16)(pTableBox->getRowSpan() + pCrsr->GetCrsrRowSpanOffset() ) );
pTableBoxStartNode = pTableBox->GetSttNd();
More information about the Libreoffice-commits
mailing list