diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-08-15 14:44:07 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-08-15 14:47:26 +0200 |
commit | 7cab33ab66e08f5757635b2989f83bbb7f9ebc67 (patch) | |
tree | 98b676b20e4279a20fef183eb2f84cf7f768fc29 /sw | |
parent | bb2ed1c3d3a7974b601e18f14a0032915bfd483c (diff) |
warning C4701: potentially uninitialized local variable 'pSectNd' used
Change-Id: I0fb1c2968971ada1d2e2e6a6b84e83ed979e2567
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/crsr/crstrvl.cxx | 80 |
1 files changed, 46 insertions, 34 deletions
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 6511c3617f03..8e9cc14a5cfa 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; + } + } } } } |