sw/source/core/crsr/crstrvl.cxx | 80 +++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 34 deletions(-)
New commits: commit 7cab33ab66e08f5757635b2989f83bbb7f9ebc67 Author: Michael Stahl <mst...@redhat.com> Date: Thu Aug 15 14:44:07 2013 +0200 warning C4701: potentially uninitialized local variable 'pSectNd' used Change-Id: I0fb1c2968971ada1d2e2e6a6b84e83ed979e2567 diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 6511c36..8e9cc14 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -293,25 +293,31 @@ sal_Bool SwCrsrShell::GotoNextTOXBase( const String* pName ) for( sal_uInt16 n = rFmts.size(); n; ) { const SwSection* pSect = rFmts[ --n ]->GetSection(); - const SwSectionNode* pSectNd; - if( TOX_CONTENT_SECTION == pSect->GetType() && - 0 != ( pSectNd = pSect->GetFmt()->GetSectionNode() ) && - m_pCurCrsr->GetPoint()->nNode < pSectNd->GetIndex() && - ( !pFnd || pFnd->GetIndex() > pSectNd->GetIndex() ) && - ( !pName || *pName == ((SwTOXBaseSection*)pSect)->GetTOXName() ) - ) + if (TOX_CONTENT_SECTION == pSect->GetType()) { - SwNodeIndex aIdx( *pSectNd, 1 ); - SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode(); - if( !pCNd ) - pCNd = GetDoc()->GetNodes().GoNext( &aIdx ); - const SwCntntFrm* pCFrm; - if( pCNd && - pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex() && - 0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout() ) ) && - ( IsReadOnlyAvailable() || !pCFrm->IsProtected() )) + SwSectionNode const*const pSectNd( + pSect->GetFmt()->GetSectionNode()); + if ( pSectNd + && m_pCurCrsr->GetPoint()->nNode < pSectNd->GetIndex() + && (!pFnd || pFnd->GetIndex() > pSectNd->GetIndex()) + && (!pName || *pName == + static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName())) { - pFnd = pCNd; + SwNodeIndex aIdx(*pSectNd, 1); + SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode(); + if (!pCNd) + pCNd = GetDoc()->GetNodes().GoNext( &aIdx ); + if (pCNd && + pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex()) + { + SwCntntFrm const*const pCFrm( + pCNd->getLayoutFrm(GetLayout())); + if (pCFrm && + (IsReadOnlyAvailable() || !pCFrm->IsProtected())) + { + pFnd = pCNd; + } + } } } } @@ -338,25 +344,31 @@ sal_Bool SwCrsrShell::GotoPrevTOXBase( const String* pName ) for( sal_uInt16 n = rFmts.size(); n; ) { const SwSection* pSect = rFmts[ --n ]->GetSection(); - const SwSectionNode* pSectNd; - if( TOX_CONTENT_SECTION == pSect->GetType() && - 0 != ( pSectNd = pSect->GetFmt()->GetSectionNode() ) && - m_pCurCrsr->GetPoint()->nNode > pSectNd->EndOfSectionIndex() && - ( !pFnd || pFnd->GetIndex() < pSectNd->GetIndex() ) && - ( !pName || *pName == ((SwTOXBaseSection*)pSect)->GetTOXName() ) - ) + if (TOX_CONTENT_SECTION == pSect->GetType()) { - SwNodeIndex aIdx( *pSectNd, 1 ); - SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode(); - if( !pCNd ) - pCNd = GetDoc()->GetNodes().GoNext( &aIdx ); - const SwCntntFrm* pCFrm; - if( pCNd && - pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex() && - 0 != ( pCFrm = pCNd->getLayoutFrm( GetLayout() ) ) && - ( IsReadOnlyAvailable() || !pCFrm->IsProtected() )) + SwSectionNode const*const pSectNd( + pSect->GetFmt()->GetSectionNode()); + if ( pSectNd + && m_pCurCrsr->GetPoint()->nNode > pSectNd->EndOfSectionIndex() + && (!pFnd || pFnd->GetIndex() < pSectNd->GetIndex()) + && (!pName || *pName == + static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName())) { - pFnd = pCNd; + SwNodeIndex aIdx(*pSectNd, 1); + SwCntntNode* pCNd = aIdx.GetNode().GetCntntNode(); + if (!pCNd) + pCNd = GetDoc()->GetNodes().GoNext( &aIdx ); + if (pCNd && + pCNd->EndOfSectionIndex() <= pSectNd->EndOfSectionIndex()) + { + SwCntntFrm const*const pCFrm( + pCNd->getLayoutFrm(GetLayout())); + if (pCFrm && + (IsReadOnlyAvailable() || !pCFrm->IsProtected())) + { + pFnd = pCNd; + } + } } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits