summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-08-24 17:03:30 +0200
committerMichael Stahl <mstahl@redhat.com>2012-08-25 01:17:06 +0200
commit411ef872a0903c4dd15d96c2f893309f6440eeca (patch)
tree953196b65f7484268d53a815acd71745ebab2b21 /sw
parentf8fd2e6a3b21ec3899a74d7400cafaba4e83ff6c (diff)
SwpHintsArray: refactor assertions:
Since 4623c603bde7678004fe6019f9d9e4b816a3d6c6 the assertions in lcl_IsLessStart/lcl_IsLessEnd trigger spuriously, because the comparison is invoked always now even on identical pointers, while the SvArray only invoked it if the 2 hints didn't have the same address; move the assertion to SwpHintsArray::Check(). Change-Id: Ida6c8e268452343ed3e90410636703c6baffbabd
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/txtnode/ndhints.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx
index af2a032ea807..e13bc4f1c3e7 100644
--- a/sw/source/core/txtnode/ndhints.cxx
+++ b/sw/source/core/txtnode/ndhints.cxx
@@ -61,7 +61,6 @@ static sal_Bool lcl_IsLessStart( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 )
{
const sal_uInt16 nS1 = static_cast<const SwTxtCharFmt&>(rHt1).GetSortNumber();
const sal_uInt16 nS2 = static_cast<const SwTxtCharFmt&>(rHt2).GetSortNumber();
- OSL_ENSURE( nS1 != nS2, "AUTOSTYLES: lcl_IsLessStart trouble" );
if ( nS1 != nS2 ) // robust
return nS1 < nS2;
}
@@ -97,7 +96,6 @@ static sal_Bool lcl_IsLessEnd( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 )
{
const sal_uInt16 nS1 = static_cast<const SwTxtCharFmt&>(rHt1).GetSortNumber();
const sal_uInt16 nS2 = static_cast<const SwTxtCharFmt&>(rHt2).GetSortNumber();
- OSL_ENSURE( nS1 != nS2, "AUTOSTYLES: lcl_IsLessEnd trouble" );
if ( nS1 != nS2 ) // robust
return nS1 > nS2;
}
@@ -260,15 +258,21 @@ bool SwpHintsArray::Check() const
( RES_TXTATR_CHARFMT != pHtLast->Which() && RES_TXTATR_AUTOFMT != pHtLast->Which() ) ||
( RES_TXTATR_CHARFMT != pHtThis->Which() && RES_TXTATR_AUTOFMT != pHtThis->Which() ) ||
( *pHtThis->GetStart() >= *pHtLast->GetEnd() ) ||
- ( ( ( (*pHtThis->GetStart() == *pHtLast->GetStart())
- && (*pHtThis->GetEnd() == *pHtLast->GetEnd())
- ) // same range
- || (*pHtThis->GetStart() == *pHtThis->GetEnd())
- )
+ ( ( (*pHtThis->GetStart() == *pHtLast->GetStart())
+ && (*pHtThis->GetEnd() == *pHtLast->GetEnd())
+ ) // same range
&& ( (pHtThis->Which() != RES_TXTATR_AUTOFMT)
|| (pHtLast->Which() != RES_TXTATR_AUTOFMT)
) // never two AUTOFMT on same range
- ),
+ && ( (pHtThis->Which() != RES_TXTATR_CHARFMT)
+ || (pHtLast->Which() != RES_TXTATR_CHARFMT)
+ || (static_cast<const SwTxtCharFmt *>(pHtThis)
+ ->GetSortNumber() !=
+ static_cast<const SwTxtCharFmt *>(pHtLast)
+ ->GetSortNumber())
+ ) // multiple CHARFMT on same range need distinct sortnr
+ )
+ || (*pHtThis->GetStart() == *pHtThis->GetEnd()),
"HintsCheck: Portion inconsistency. "
"This can be temporarily ok during undo operations" );