[Libreoffice-commits] core.git: 2 commits - sw/source
Caolán McNamara
caolanm at redhat.com
Mon Mar 7 12:08:59 UTC 2016
sw/source/core/layout/sectfrm.cxx | 36 +++++++++++++++++++++---------------
1 file changed, 21 insertions(+), 15 deletions(-)
New commits:
commit 48c887fc7a9adfe390512c807c99b08b5f5b41f3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Mar 7 12:08:15 2016 +0000
convert DEFINE to anonymous function
Change-Id: I9b62f02ac0013d1da13c176155c5742972a43fe3
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 781dd96..1d3ad20 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -579,9 +579,15 @@ static SwContentFrame* lcl_GetNextContentFrame( const SwLayoutFrame* pLay, bool
return pContentFrame;
}
-#define FIRSTLEAF( pLayFrame ) ( ( pLayFrame->Lower() && pLayFrame->Lower()->IsColumnFrame() )\
- ? pLayFrame->GetNextLayoutLeaf() \
- : pLayFrame )
+namespace
+{
+ SwLayoutFrame* FirstLeaf(SwSectionFrame* pLayFrame)
+ {
+ if (pLayFrame->Lower() && pLayFrame->Lower()->IsColumnFrame())
+ return pLayFrame->GetNextLayoutLeaf();
+ return pLayFrame;
+ }
+}
void SwSectionFrame::MoveContentAndDelete( SwSectionFrame* pDel, bool bSave )
{
@@ -633,7 +639,7 @@ void SwSectionFrame::MoveContentAndDelete( SwSectionFrame* pDel, bool bSave )
{ // Search for the appropriate insert position
if( pNxtSct && pNxtSct->GetFormat() == pParent )
{ // Here we can insert outselves at the beginning
- pUp = FIRSTLEAF( pNxtSct );
+ pUp = FirstLeaf( pNxtSct );
pPrv = nullptr;
if( pPrvSct && !( pPrvSct->GetFormat() == pParent ) )
pPrvSct = nullptr; // In order that nothing is merged
@@ -665,7 +671,7 @@ void SwSectionFrame::MoveContentAndDelete( SwSectionFrame* pDel, bool bSave )
pPrvSct->Init();
SWRECTFN( pUp )
(pPrvSct->*fnRect->fnMakePos)( pUp, pPrv, true );
- pUp = FIRSTLEAF( pPrvSct );
+ pUp = FirstLeaf( pPrvSct );
pPrv = nullptr;
}
pPrvSct = nullptr; // Such that nothing will be merged
@@ -1460,7 +1466,7 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
if( WrongPageDesc( pPg ) )
bWrongPage = true;
else
- return FIRSTLEAF( pSect->GetFollow() );
+ return FirstLeaf( pSect->GetFollow() );
}
else
{
@@ -1488,7 +1494,7 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
if( WrongPageDesc( pNxtPg ) )
bWrongPage = true;
else
- return FIRSTLEAF( pSect->GetFollow() );
+ return FirstLeaf( pSect->GetFollow() );
}
}
}
@@ -1641,7 +1647,7 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
pNew->SimpleFormat();
}
// The wanted layout sheet is now the first of the determined SctFrames:
- pLayLeaf = FIRSTLEAF( pNew );
+ pLayLeaf = FirstLeaf( pNew );
}
return pLayLeaf;
}
@@ -1802,7 +1808,7 @@ SwLayoutFrame *SwFrame::GetPrevSctLeaf( MakePageType )
SWRECTFN( pNew )
(pNew->*fnRect->fnMakePos)( pLayLeaf, pNew->GetPrev(), true );
- pLayLeaf = FIRSTLEAF( pNew );
+ pLayLeaf = FirstLeaf( pNew );
if( !pNew->Lower() ) // Format single column sections
{
pNew->MakePos();
@@ -1813,7 +1819,7 @@ SwLayoutFrame *SwFrame::GetPrevSctLeaf( MakePageType )
}
else
{
- pLayLeaf = FIRSTLEAF( pNew );
+ pLayLeaf = FirstLeaf( pNew );
if( pLayLeaf->IsColBodyFrame() )
{
// In existent section columns we're looking for the last not empty
commit a0b634bf57511f250e0406dc382178a1699804f0
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Mar 7 11:32:57 2016 +0000
OSL_ENSURE followed by deref -> assert
Change-Id: Ib815da2f341096775052d2280d62a210a856fdf8
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 8d5555d..781dd96 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -94,7 +94,7 @@ SwSectionFrame::SwSectionFrame( SwSectionFrame &rSect, bool bMaster ) :
// frame and its insert in the layout.
void SwSectionFrame::Init()
{
- OSL_ENSURE( GetUpper(), "SwSectionFrame::Init before insertion?!" );
+ assert(GetUpper() && "SwSectionFrame::Init before insertion?!");
SWRECTFN( this )
long nWidth = (GetUpper()->Prt().*fnRect->fnGetWidth)();
(Frame().*fnRect->fnSetWidth)( nWidth );
@@ -467,7 +467,7 @@ void SwSectionFrame::MergeNext( SwSectionFrame* pNxt )
|*/
bool SwSectionFrame::SplitSect( SwFrame* pFrame, bool bApres )
{
- OSL_ENSURE( pFrame, "SplitSect: Why?" );
+ assert(pFrame && "SplitSect: Why?");
SwFrame* pOther = bApres ? pFrame->FindNext() : pFrame->FindPrev();
if( !pOther )
return false;
@@ -1446,7 +1446,7 @@ SwLayoutFrame *SwFrame::GetNextSctLeaf( MakePageType eMakePage )
SwSectionFrame *pSect = FindSctFrame();
bool bWrongPage = false;
- OSL_ENSURE( pSect, "GetNextSctLeaf: Missing SectionFrame" );
+ assert(pSect && "GetNextSctLeaf: Missing SectionFrame");
// Shortcut for sections with Follows. That's ok,
// if no columns or pages (except dummy pages) lie in between.
@@ -2555,7 +2555,7 @@ void SwRootFrame::InsertEmptySct( SwSectionFrame* pDel )
void SwRootFrame::_DeleteEmptySct()
{
- OSL_ENSURE( mpDestroy, "Keine Liste, keine Kekse" );
+ assert(mpDestroy && "Keine Liste, keine Kekse");
while( !mpDestroy->empty() )
{
SwSectionFrame* pSect = *mpDestroy->begin();
@@ -2587,7 +2587,7 @@ void SwRootFrame::_DeleteEmptySct()
void SwRootFrame::_RemoveFromList( SwSectionFrame* pSct )
{
- OSL_ENSURE( mpDestroy, "Where's my list?" );
+ assert(mpDestroy && "Where's my list?");
mpDestroy->erase( pSct );
}
More information about the Libreoffice-commits
mailing list