diff options
author | Michael Stahl <mstahl@redhat.com> | 2014-12-03 00:05:14 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-12-03 13:13:30 +0100 |
commit | 7ae2a4d68a79408c0be7d5b6cb349d0aaac38a01 (patch) | |
tree | 00cadaec42e5c67049ec27d3dd5d78b6b4fcc5b5 /editeng | |
parent | 4c21d3ac912bdb7eb013d3ee440464489a3838b7 (diff) |
editeng: there's yet another checking function hidden at dbglevel=3
Change-Id: Idd54bd4fd87cd138a2daf363bd692440a01e2624
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editdbg.cxx | 15 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 10 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.hxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 4 |
4 files changed, 17 insertions, 14 deletions
diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index 3db1715e7f5a..c78a1b64a5c2 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -497,21 +497,20 @@ sal_Bool ParaPortion::DbgCheckTextPortions() } #endif -bool CheckOrderedList(const CharAttribList::AttribsType& rAttribs, bool bStart) +#endif + +#if OSL_DEBUG_LEVEL > 0 +void CheckOrderedList(const CharAttribList::AttribsType& rAttribs, bool bStart) { - sal_uInt16 nPrev = 0; + sal_Int32 nPrev = 0; for (size_t nAttr = 0; nAttr < rAttribs.size(); ++nAttr) { const EditCharAttrib& rAttr = rAttribs[nAttr]; - sal_uInt16 nCur = bStart ? rAttr.GetStart() : rAttr.GetEnd(); - if ( nCur < nPrev ) - return false; - + sal_Int32 const nCur = bStart ? rAttr.GetStart() : rAttr.GetEnd(); + assert(nCur >= nPrev); nPrev = nCur; } - return true; } - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 9eb25bb6d421..13889f493c5b 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -1413,8 +1413,8 @@ void ContentNode::ExpandAttribs( sal_Int32 nIndex, sal_Int32 nNew, SfxItemPool& mpWrongList->TextInserted( nIndex, nNew, bSep ); } -#if OSL_DEBUG_LEVEL > 2 - OSL_ENSURE( CheckOrderedList( aCharAttribList.GetAttribs(), sal_True ), "Expand: Start List distorted" ); +#if OSL_DEBUG_LEVEL > 0 + CharAttribList::DbgCheckAttribs(aCharAttribList); #endif } @@ -1501,8 +1501,8 @@ void ContentNode::CollapsAttribs( sal_Int32 nIndex, sal_Int32 nDeleted, SfxItemP if (mpWrongList) mpWrongList->TextDeleted(nIndex, nDeleted); -#if OSL_DEBUG_LEVEL > 2 - OSL_ENSURE( CheckOrderedList( aCharAttribList.GetAttribs(), sal_True ), "Collaps: Start list distorted" ); +#if OSL_DEBUG_LEVEL > 0 + CharAttribList::DbgCheckAttribs(aCharAttribList); #endif } @@ -3005,6 +3005,8 @@ void CharAttribList::DbgCheckAttribs(CharAttribList const& rAttribs) assert(zero_set.insert(std::make_pair(rAttr.GetStart(), rAttr.Which())).second && "duplicate 0-length attribute detected"); } } + CheckOrderedList(rAttribs.GetAttribs(), true); +// CheckOrderedList(rAttribs.GetAttribs(), false); // this does not work - need 2nd array to sort by ends? } #endif diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index 5a1d2e39c50e..0740757cd121 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -835,7 +835,7 @@ inline EditCharAttrib* GetAttrib(CharAttribList::AttribsType& rAttribs, sal_Int3 return (nAttr < (sal_Int32)rAttribs.size()) ? &rAttribs[nAttr] : NULL; } -bool CheckOrderedList(const CharAttribList::AttribsType& rAttribs, bool bStart); +void CheckOrderedList(const CharAttribList::AttribsType& rAttribs, bool bStart); // class EditEngineItemPool diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 6af9a8f64399..5d1719486b8d 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -1297,7 +1297,9 @@ EditSelection ImpEditEngine::InsertTextObject( const EditTextObject& rTextObject pPortion->MarkSelectionInvalid( nStartPos, pC->GetText().getLength() ); } - DBG_ASSERT( CheckOrderedList( aPaM.GetNode()->GetCharAttribs().GetAttribs(), true ), "InsertBinTextObject: Start-Liste distorted" ); +#if OSL_DEBUG_LEVEL > 0 + CharAttribList::DbgCheckAttribs(aPaM.GetNode()->GetCharAttribs()); +#endif bool bParaAttribs = false; if ( bNewContent || ( ( n > 0 ) && ( n < (nContents-1) ) ) ) |