Kaydet (Commit) 411ef872 authored tarafından Michael Stahl's avatar Michael Stahl

SwpHintsArray: refactor assertions:

Since 4623c603 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
üst f8fd2e6a
...@@ -61,7 +61,6 @@ static sal_Bool lcl_IsLessStart( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 ) ...@@ -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 nS1 = static_cast<const SwTxtCharFmt&>(rHt1).GetSortNumber();
const sal_uInt16 nS2 = static_cast<const SwTxtCharFmt&>(rHt2).GetSortNumber(); const sal_uInt16 nS2 = static_cast<const SwTxtCharFmt&>(rHt2).GetSortNumber();
OSL_ENSURE( nS1 != nS2, "AUTOSTYLES: lcl_IsLessStart trouble" );
if ( nS1 != nS2 ) // robust if ( nS1 != nS2 ) // robust
return nS1 < nS2; return nS1 < nS2;
} }
...@@ -97,7 +96,6 @@ static sal_Bool lcl_IsLessEnd( const SwTxtAttr &rHt1, const SwTxtAttr &rHt2 ) ...@@ -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 nS1 = static_cast<const SwTxtCharFmt&>(rHt1).GetSortNumber();
const sal_uInt16 nS2 = static_cast<const SwTxtCharFmt&>(rHt2).GetSortNumber(); const sal_uInt16 nS2 = static_cast<const SwTxtCharFmt&>(rHt2).GetSortNumber();
OSL_ENSURE( nS1 != nS2, "AUTOSTYLES: lcl_IsLessEnd trouble" );
if ( nS1 != nS2 ) // robust if ( nS1 != nS2 ) // robust
return nS1 > nS2; return nS1 > nS2;
} }
...@@ -260,15 +258,21 @@ bool SwpHintsArray::Check() const ...@@ -260,15 +258,21 @@ bool SwpHintsArray::Check() const
( RES_TXTATR_CHARFMT != pHtLast->Which() && RES_TXTATR_AUTOFMT != pHtLast->Which() ) || ( RES_TXTATR_CHARFMT != pHtLast->Which() && RES_TXTATR_AUTOFMT != pHtLast->Which() ) ||
( RES_TXTATR_CHARFMT != pHtThis->Which() && RES_TXTATR_AUTOFMT != pHtThis->Which() ) || ( RES_TXTATR_CHARFMT != pHtThis->Which() && RES_TXTATR_AUTOFMT != pHtThis->Which() ) ||
( *pHtThis->GetStart() >= *pHtLast->GetEnd() ) || ( *pHtThis->GetStart() >= *pHtLast->GetEnd() ) ||
( ( ( (*pHtThis->GetStart() == *pHtLast->GetStart()) ( ( (*pHtThis->GetStart() == *pHtLast->GetStart())
&& (*pHtThis->GetEnd() == *pHtLast->GetEnd()) && (*pHtThis->GetEnd() == *pHtLast->GetEnd())
) // same range ) // same range
|| (*pHtThis->GetStart() == *pHtThis->GetEnd())
)
&& ( (pHtThis->Which() != RES_TXTATR_AUTOFMT) && ( (pHtThis->Which() != RES_TXTATR_AUTOFMT)
|| (pHtLast->Which() != RES_TXTATR_AUTOFMT) || (pHtLast->Which() != RES_TXTATR_AUTOFMT)
) // never two AUTOFMT on same range ) // 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. " "HintsCheck: Portion inconsistency. "
"This can be temporarily ok during undo operations" ); "This can be temporarily ok during undo operations" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment