[Libreoffice-commits] core.git: sw/source
Michael Stahl
mstahl at redhat.com
Mon Feb 5 09:55:17 UTC 2018
sw/source/core/bastyp/swcache.cxx | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
New commits:
commit 3c280b7235967b28905220f72333c7029911fb82
Author: Michael Stahl <mstahl at redhat.com>
Date: Fri Feb 2 21:24:37 2018 +0100
sw: convert some SAL_WARN to assert in SwCache
Change-Id: Id148253a2f2c60912cbfbe9628f5ddec56a48952
Reviewed-on: https://gerrit.libreoffice.org/49165
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx
index 8d8b5997ff9a..282e5c6d4307 100644
--- a/sw/source/core/bastyp/swcache.cxx
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -29,11 +29,14 @@
void SwCache::Check()
{
if ( !m_pRealFirst )
+ {
+ assert(m_pFirst == nullptr && m_pLast == nullptr);
return;
+ }
// consistency check
- SAL_WARN_IF( m_pLast->GetNext(), "sw.core", "Last but not last." );
- SAL_WARN_IF( m_pRealFirst->GetPrev(), "sw.core", "First but not first." );
+ assert(m_pLast->GetNext() == nullptr);
+ assert(m_pRealFirst->GetPrev() == nullptr);
sal_uInt16 nCnt = 0;
bool bFirstFound = false;
SwCacheObj *pObj = m_pRealFirst;
@@ -44,17 +47,19 @@ void SwCache::Check()
SwCacheObj *pTmp = m_pLast;
while ( pTmp && pTmp != pObj )
pTmp = pTmp->GetPrev();
- SAL_WARN_IF( !pTmp, "sw.core", "Object not found." );
+ assert(pTmp && "Object not found.");
++nCnt;
if ( pObj == m_pFirst )
bFirstFound = true;
if ( !pObj->GetNext() )
- SAL_WARN_IF( pObj != m_pLast, "sw.core", "Last not Found." );
+ {
+ assert(pObj == m_pLast);
+ }
pObj = pObj->GetNext();
- SAL_WARN_IF(pObj == pOldRealFirst, "sw.core", "Recursion in SwCache.");
+ assert(pObj != pOldRealFirst);
}
- SAL_WARN_IF( !bFirstFound, "sw.core", "First not Found." );
+ assert(bFirstFound);
SAL_WARN_IF( nCnt + m_aFreePositions.size() != size(), "sw.core", "Lost Chain." );
SAL_WARN_IF(
size() == m_nCurMax && m_nCurMax != m_aFreePositions.size() + nCnt, "sw.core",
More information about the Libreoffice-commits
mailing list