summaryrefslogtreecommitdiff
path: root/sw/source/core/layout
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-06-10 10:02:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-06-10 20:43:38 +0200
commit474a9171e7e996116037bb9ca6c985d0a3d6c0c3 (patch)
tree7ca10ffc1a6514817ff173e41d1ac04251b69c9a /sw/source/core/layout
parentb0ede91f5e64767bd3ba9f427687e1faf2297e0c (diff)
loplugin:buriedassign in sw
limited this only fixing assignments inside "if" statements, since other things are harder to change Change-Id: If3188a3e3d5fcd94123211c97fee097ece5e2797 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95990 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/layout')
-rw-r--r--sw/source/core/layout/findfrm.cxx4
-rw-r--r--sw/source/core/layout/flowfrm.cxx6
-rw-r--r--sw/source/core/layout/frmtool.cxx4
-rw-r--r--sw/source/core/layout/layact.cxx4
-rw-r--r--sw/source/core/layout/paintfrm.cxx4
-rw-r--r--sw/source/core/layout/sectfrm.cxx6
-rw-r--r--sw/source/core/layout/tabfrm.cxx10
-rw-r--r--sw/source/core/layout/trvlfrm.cxx3
-rw-r--r--sw/source/core/layout/wsfrm.cxx21
9 files changed, 38 insertions, 24 deletions
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index 548399e40478..a2d6508e459c 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -1229,8 +1229,8 @@ SwFrame *SwFrame::FindPrev_()
void SwFrame::ImplInvalidateNextPos( bool bNoFootnote )
{
- SwFrame *pFrame;
- if ( nullptr != (pFrame = FindNext_()) )
+ SwFrame *pFrame = FindNext_();
+ if ( nullptr != pFrame )
{
if( pFrame->IsSctFrame() )
{
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index e33cb736ce19..b67fdc5a07bd 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -474,7 +474,8 @@ bool SwFlowFrame::PasteTree( SwFrame *pStart, SwLayoutFrame *pParent, SwFrame *p
// On the way there, we invalidate as required.
if ( pSibling )
{
- if ( nullptr != (pStart->mpPrev = pSibling->GetPrev()) )
+ pStart->mpPrev = pSibling->GetPrev();
+ if ( nullptr != pStart->mpPrev )
pStart->GetPrev()->mpNext = pStart;
else
pParent->m_pLower = pStart;
@@ -483,7 +484,8 @@ bool SwFlowFrame::PasteTree( SwFrame *pStart, SwLayoutFrame *pParent, SwFrame *p
}
else
{
- if ( nullptr == (pStart->mpPrev = pParent->Lower()) )
+ pStart->mpPrev = pParent->Lower();
+ if ( nullptr == pStart->mpPrev )
pParent->m_pLower = pStart;
else
//i#100782
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index ddd7d41e3bc7..c41e61b98b65 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2718,8 +2718,8 @@ SwFrame *SaveContent( SwLayoutFrame *pLay, SwFrame *pStart )
if( pLay->IsSctFrame() && pLay->Lower() && pLay->Lower()->IsColumnFrame() )
sw_RemoveFootnotes( static_cast<SwColumnFrame*>(pLay->Lower()), true, true );
- SwFrame *pSav;
- if ( nullptr == (pSav = pLay->ContainsAny()) )
+ SwFrame *pSav = pLay->ContainsAny();
+ if ( nullptr == pSav )
return nullptr;
if( pSav->IsInFootnote() && !pLay->IsInFootnote() )
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 7f913c8a02ff..f84d33eccb3f 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -862,8 +862,8 @@ static const SwFrame *lcl_FindFirstInvaLay( const SwFrame *pFrame, long nBottom
{
if (lcl_IsInvaLay(pFrame, nBottom))
return pFrame;
- const SwFrame *pTmp;
- if ( nullptr != (pTmp = lcl_FindFirstInvaLay( pFrame, nBottom )) )
+ const SwFrame *pTmp = lcl_FindFirstInvaLay( pFrame, nBottom );
+ if ( nullptr != pTmp )
return pTmp;
}
pFrame = pFrame->GetNext();
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index a77960ee3e98..9a343e793a51 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3796,9 +3796,9 @@ bool SwFlyFrame::IsBackgroundTransparent() const
bool SwFlyFrame::IsPaint( SdrObject *pObj, const SwViewShell *pSh )
{
- SdrObjUserCall *pUserCall;
+ SdrObjUserCall *pUserCall = GetUserCall(pObj);
- if ( nullptr == ( pUserCall = GetUserCall(pObj) ) )
+ if ( nullptr == pUserCall )
return true;
//Attribute dependent, don't paint for printer or Preview
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index de9a62430822..807780612bdc 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -281,8 +281,10 @@ void SwSectionFrame::Cut_( bool bRemove )
{
InvalidateNextPos();
// Someone has to take over the retouching: predecessor or Upper
- if ( nullptr != (pFrame = GetPrev()) )
- { pFrame->SetRetouche();
+ pFrame = GetPrev();
+ if ( nullptr != pFrame )
+ {
+ pFrame->SetRetouche();
pFrame->Prepare( PrepareHint::WidowsOrphans );
if ( pFrame->IsContentFrame() )
pFrame->InvalidatePage( pPage );
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index f4aed1ed650d..0a3e5f997357 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3236,8 +3236,8 @@ void SwTabFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
InvalidatePrt_();
if ( nInvFlags & 0x40 )
InvalidatePos_();
- SwFrame *pTmp;
- if ( nullptr != (pTmp = GetIndNext()) )
+ SwFrame *pTmp = GetIndNext();
+ if ( nullptr != pTmp )
{
if ( nInvFlags & 0x04 )
{
@@ -3599,8 +3599,10 @@ void SwTabFrame::Cut()
{
InvalidateNextPos();
//Someone has to do the retouch: predecessor or upper
- if ( nullptr != (pFrame = GetPrev()) )
- { pFrame->SetRetouche();
+ pFrame = GetPrev();
+ if ( nullptr != pFrame )
+ {
+ pFrame->SetRetouche();
pFrame->Prepare( PrepareHint::WidowsOrphans );
pFrame->InvalidatePos_();
if ( pFrame->IsContentFrame() )
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index c7de73e4e0e7..8ea9580f9eb4 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -1099,7 +1099,8 @@ bool GetFrameInPage( const SwContentFrame *pCnt, SwWhichPage fnWhichPage,
return false;
//Now the desired ContentFrame below the page
- if( nullptr == (pCnt = (*fnPosPage)(pLayoutFrame)) )
+ pCnt = (*fnPosPage)(pLayoutFrame);
+ if( nullptr == pCnt )
return false;
else
{
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 57db1547a1c6..c8be85e67d2d 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -827,7 +827,8 @@ void SwFrame::InsertBefore( SwLayoutFrame* pParent, SwFrame* pBehind )
mpNext = pBehind;
if( pBehind )
{ //Insert before pBehind.
- if( nullptr != (mpPrev = pBehind->mpPrev) )
+ mpPrev = pBehind->mpPrev;
+ if( nullptr != mpPrev )
mpPrev->mpNext = this;
else
mpUpper->m_pLower = this;
@@ -863,7 +864,8 @@ void SwFrame::InsertBehind( SwLayoutFrame *pParent, SwFrame *pBefore )
if ( pBefore )
{
//Insert after pBefore
- if ( nullptr != (mpNext = pBefore->mpNext) )
+ mpNext = pBefore->mpNext;
+ if ( nullptr != mpNext )
mpNext->mpPrev = this;
pBefore->mpNext = this;
}
@@ -968,7 +970,8 @@ bool SwFrame::InsertGroupBefore( SwFrame* pParent, SwFrame* pBehind, SwFrame* pS
pLast->mpNext = pBehind;
if( pBehind )
{ // Insert before pBehind.
- if( nullptr != (mpPrev = pBehind->mpPrev) )
+ mpPrev = pBehind->mpPrev;
+ if( nullptr != mpPrev )
mpPrev->mpNext = this;
else
mpUpper->m_pLower = this;
@@ -1101,7 +1104,8 @@ void SwContentFrame::Paste( SwFrame* pParent, SwFrame* pSibling)
{
while ( pNxt && pNxt->IsInTab() )
{
- if( nullptr != (pNxt = pNxt->FindTabFrame()) )
+ pNxt = pNxt->FindTabFrame();
+ if( nullptr != pNxt )
pNxt = pNxt->FindNextCnt();
}
if ( pNxt )
@@ -1143,7 +1147,8 @@ void SwContentFrame::Cut()
{
while ( pNxt && pNxt->IsInTab() )
{
- if( nullptr != (pNxt = pNxt->FindTabFrame()) )
+ pNxt = pNxt->FindTabFrame();
+ if( nullptr != pNxt )
pNxt = pNxt->FindNextCnt();
}
if ( pNxt )
@@ -1154,7 +1159,8 @@ void SwContentFrame::Cut()
}
}
- if( nullptr != (pFrame = GetIndNext()) )
+ pFrame = GetIndNext();
+ if( pFrame )
{
// The old follow may have calculated a gap to the predecessor which
// now becomes obsolete or different as it becomes the first one itself
@@ -1187,7 +1193,8 @@ void SwContentFrame::Cut()
{
InvalidateNextPos();
//Someone needs to do the retouching: predecessor or upper
- if ( nullptr != (pFrame = GetPrev()) )
+ pFrame = GetPrev();
+ if ( nullptr != pFrame )
{ pFrame->SetRetouche();
pFrame->Prepare( PrepareHint::WidowsOrphans );
pFrame->InvalidatePos_();