[Libreoffice-commits] core.git: 3 commits - sw/source
Michael Stahl
mstahl at redhat.com
Wed Apr 19 14:01:30 UTC 2017
sw/source/core/crsr/crsrsh.cxx | 24 ++++++++++++------------
sw/source/core/doc/docnew.cxx | 17 ++++++++---------
sw/source/core/doc/docredln.cxx | 10 ++++++----
3 files changed, 26 insertions(+), 25 deletions(-)
New commits:
commit b9b5e8e1ae5e0e6d7037a7ffc44996c91822c98a
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Apr 19 15:54:45 2017 +0200
sw: convert some OSL_ENSURE to assert in crsrsh.cxx
Change-Id: I40e49716c3188f403f7bbe15bb0dca820eb353a9
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index e22be8f4a772..b1c653b23812 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -119,8 +119,8 @@ void CheckRange( SwCursor* pCurrentCursor )
SwPaM * SwCursorShell::CreateCursor()
{
- // don't create Cursor in a table Selection (sic!)
- OSL_ENSURE( !IsTableMode(), "in table Selection" );
+ // don't create new Cursor with active table Selection
+ assert(!IsTableMode());
// New cursor as copy of current one. Add to the ring.
// Links point to previously created one, ie forward.
@@ -143,8 +143,8 @@ SwPaM * SwCursorShell::CreateCursor()
*/
bool SwCursorShell::DestroyCursor()
{
- // don't delete Cursor within table selection
- OSL_ENSURE( !IsTableMode(), "in table Selection" );
+ // don't delete Cursor with active table Selection
+ assert(!IsTableMode());
// Is there a next one? Don't do anything if not.
if(!m_pCurrentCursor->IsMultiSelection())
@@ -406,8 +406,8 @@ void SwCursorShell::UpdateMarkedListLevel()
{
if ( pTextNd->IsInList() )
{
- OSL_ENSURE( pTextNd->GetActualListLevel() >= 0 &&
- pTextNd->GetActualListLevel() < MAXLEVEL, "Which level?");
+ assert(pTextNd->GetActualListLevel() >= 0 &&
+ pTextNd->GetActualListLevel() < MAXLEVEL);
MarkListLevel( pTextNd->GetListId(),
pTextNd->GetActualListLevel() );
}
@@ -846,14 +846,14 @@ int SwCursorShell::SetCursor( const Point &rLPt, bool bOnlyText, bool bBlock )
void SwCursorShell::TableCursorToCursor()
{
- OSL_ENSURE( m_pTableCursor, "TableCursorToCursor: Why?" );
+ assert(m_pTableCursor);
delete m_pTableCursor;
m_pTableCursor = nullptr;
}
void SwCursorShell::BlockCursorToCursor()
{
- OSL_ENSURE( m_pBlockCursor, "BlockCursorToCursor: Why?" );
+ assert(m_pBlockCursor);
if( m_pBlockCursor && !HasSelection() )
{
SwPaM& rPam = m_pBlockCursor->getShellCursor();
@@ -1871,7 +1871,7 @@ void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd )
void SwCursorShell::RefreshBlockCursor()
{
- OSL_ENSURE( m_pBlockCursor, "Don't call me without a block cursor" );
+ assert(m_pBlockCursor);
SwShellCursor &rBlock = m_pBlockCursor->getShellCursor();
Point aPt = rBlock.GetPtPos();
SwContentFrame* pFrame = rBlock.GetContentNode()->getLayoutFrame( GetLayout(), &aPt, rBlock.GetPoint(), false );
@@ -2333,7 +2333,7 @@ bool SwCursorShell::ExtendSelection( bool bEnd, sal_Int32 nCount )
SwPosition* pPos = bEnd ? m_pCurrentCursor->End() : m_pCurrentCursor->Start();
SwTextNode* pTextNd = pPos->nNode.GetNode().GetTextNode();
- OSL_ENSURE( pTextNd, "no text node; how should this then be extended?" );
+ assert(pTextNd);
sal_Int32 nPos = pPos->nContent.GetIndex();
if( bEnd )
@@ -2809,7 +2809,7 @@ bool SwCursorShell::FindValidContentNode( bool bOnlyText )
{
if( m_pTableCursor )
{
- OSL_ENSURE( false, "Did not remove table selection!" );
+ assert(!"Did not remove table selection!");
return false;
}
@@ -3311,7 +3311,7 @@ void SwCursorShell::ClearUpCursors()
}
bool bFound = (pNode != nullptr);
- OSL_ENSURE(bFound, "no content node found");
+ assert(bFound);
if (bFound)
{
commit e0f9dc97490f69fc2f3cdfb6367ac6893c7b170b
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Apr 19 15:53:21 2017 +0200
sw: replace buggy OSL_ENSURE in CalcStartEnd()
Actually one case was missing.
Change-Id: I08895f730c48d1d4bef6965ff39595ac7db5b42a
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 0ccc138ce105..ae4f346a9c9e 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1197,13 +1197,16 @@ void SwRangeRedline::CalcStartEnd( sal_uLong nNdIdx, sal_Int32& rStart, sal_Int3
rStart = 0; // Paragraph is completely enclosed
rEnd = COMPLETE_STRING;
}
- else
+ else if (pREnd->nNode == nNdIdx)
{
- OSL_ENSURE( pREnd->nNode == nNdIdx,
- "SwRedlineItr::Seek: GetRedlinePos Error" );
rStart = 0; // Paragraph is overlapped in the beginning
rEnd = pREnd->nContent.GetIndex();
}
+ else // redline ends before paragraph
+ {
+ rStart = COMPLETE_STRING;
+ rEnd = COMPLETE_STRING;
+ }
}
else if( pRStt->nNode == nNdIdx )
{
@@ -1414,7 +1417,6 @@ void SwRangeRedline::DelCopyOfSection(size_t nMyPos)
// current ones can be affected.
const SwRedlineTable& rTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable();
size_t n = nMyPos;
- OSL_ENSURE( n != USHRT_MAX, "How strange. We don't exist!" );
for( bool bBreak = false; !bBreak && n > 0; )
{
--n;
commit 500ffae7c388a12b1d7fca4917ec872fd629392f
Author: Michael Stahl <mstahl at redhat.com>
Date: Wed Apr 19 15:52:54 2017 +0200
sw: convert some OSL_ENSURE to assert in docnew.cxx
Change-Id: Ic3962728abc31accc7dd51b5291c58c5bfaa21a6
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index d579215bcfee..cb2a35160691 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -500,8 +500,8 @@ SwDoc::~SwDoc()
mpFootnoteInfo->ReleaseCollection();
mpEndNoteInfo->ReleaseCollection();
- OSL_ENSURE( mpDfltTextFormatColl == (*mpTextFormatCollTable)[0],
- "Default-Text-Collection must always be at the start" );
+ assert(mpDfltTextFormatColl == (*mpTextFormatCollTable)[0]
+ && "Default-Text-Collection must always be at the start");
// Optimization: Based on the fact that Standard is always 2nd in the
// array, we should delete it as the last. With this we avoid
@@ -511,8 +511,8 @@ SwDoc::~SwDoc()
mpTextFormatCollTable->DeleteAndDestroy(1, mpTextFormatCollTable->size());
delete mpTextFormatCollTable;
- OSL_ENSURE( mpDfltGrfFormatColl == (*mpGrfFormatCollTable)[0],
- "DefaultGrfCollection must always be at the start" );
+ assert(mpDfltGrfFormatColl == (*mpGrfFormatCollTable)[0]
+ && "DefaultGrfCollection must always be at the start");
mpGrfFormatCollTable->DeleteAndDestroy(1, mpGrfFormatCollTable->size());
delete mpGrfFormatCollTable;
@@ -607,9 +607,8 @@ void SwDoc::SetDocShell( SwDocShell* pDSh )
// set DocShell pointer also on DrawModel
InitDrawModelAndDocShell(mpDocShell, GetDocumentDrawModelManager().GetDrawModel());
- OSL_ENSURE(!GetDocumentDrawModelManager().GetDrawModel() ||
- GetDocumentDrawModelManager().GetDrawModel()->GetPersist() == GetPersist(),
- "draw model's persist is out of sync");
+ assert(!GetDocumentDrawModelManager().GetDrawModel() ||
+ GetDocumentDrawModelManager().GetDrawModel()->GetPersist() == GetPersist());
}
}
@@ -643,8 +642,8 @@ void SwDoc::ClearDoc()
// if there are still FlyFrames dangling around, delete them too
while ( !mpSpzFrameFormatTable->empty() )
getIDocumentLayoutAccess().DelLayoutFormat((*mpSpzFrameFormatTable)[mpSpzFrameFormatTable->size()-1]);
- OSL_ENSURE( !GetDocumentDrawModelManager().GetDrawModel() || !GetDocumentDrawModelManager().GetDrawModel()->GetPage(0)->GetObjCount(),
- "not all DrawObjects removed from the page" );
+ assert(!GetDocumentDrawModelManager().GetDrawModel()
+ || !GetDocumentDrawModelManager().GetDrawModel()->GetPage(0)->GetObjCount());
getIDocumentRedlineAccess().GetRedlineTable().DeleteAndDestroyAll();
getIDocumentRedlineAccess().GetExtraRedlineTable().DeleteAndDestroyAll();
More information about the Libreoffice-commits
mailing list