[Libreoffice-commits] .: sw/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Tue Apr 24 02:06:30 PDT 2012


 sw/source/core/bastyp/swcache.cxx    |   18 +++++++++---------
 sw/source/core/crsr/crsrsh.cxx       |    7 +------
 sw/source/core/doc/docredln.cxx      |    8 ++++----
 sw/source/core/layout/calcmove.cxx   |    8 ++++----
 sw/source/core/layout/ftnfrm.cxx     |   12 ++++++------
 sw/source/core/table/swnewtable.cxx  |   26 +++++++++++++-------------
 sw/source/core/text/txtio.cxx        |    4 +---
 sw/source/filter/writer/wrtswtbl.cxx |    2 +-
 8 files changed, 39 insertions(+), 46 deletions(-)

New commits:
commit a7c7942fd1946da978673d2c350630f83603d18d
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Tue Apr 24 11:05:51 2012 +0200

    DBG_UTIL vs OSL_DEBUG_LEVEL confusion

diff --git a/sw/source/core/bastyp/swcache.cxx b/sw/source/core/bastyp/swcache.cxx
index 78e2960..9c0187f 100644
--- a/sw/source/core/bastyp/swcache.cxx
+++ b/sw/source/core/bastyp/swcache.cxx
@@ -49,8 +49,8 @@ void SwCache::Check()
         return;
 
     //Konsistenspruefung.
-    OSL_ENSURE( !pLast->GetNext(), "Last but not last." );
-    OSL_ENSURE( !pRealFirst->GetPrev(), "First but not first." );
+    SAL_WARN_IF( pLast->GetNext(), "sw", "Last but not last." );
+    SAL_WARN_IF( pRealFirst->GetPrev(), "sw", "First but not first." );
     sal_uInt16 nCnt = 0;
     sal_Bool bFirstFound = sal_False;
     SwCacheObj *pObj = pRealFirst;
@@ -61,20 +61,20 @@ void SwCache::Check()
         SwCacheObj *pTmp = pLast;
         while ( pTmp && pTmp != pObj )
             pTmp = pTmp->GetPrev();
-        OSL_ENSURE( pTmp, "Objekt not found." );
+        SAL_WARN_IF( !pTmp, "sw", "Objekt not found." );
 
         ++nCnt;
         if ( pObj == pFirst )
             bFirstFound = sal_True;
         if ( !pObj->GetNext() )
-            OSL_ENSURE( pObj == pLast, "Last not Found." );
+            SAL_WARN_IF( pObj != pLast, "sw", "Last not Found." );
         pObj = pObj->GetNext();
-        OSL_ENSURE( pObj != pRekursive, "Recursion in SwCache." );
+        SAL_WARN_IF( pObj == pRekursive, "sw", "Recursion in SwCache." );
     }
-    OSL_ENSURE( bFirstFound, "First not Found." );
-    OSL_ENSURE( (nCnt + aFreePositions.size()) == Count(), "Lost Chain." );
-    OSL_ENSURE(
-        Count() != nCurMax || nCurMax == aFreePositions.size() + nCnt,
+    SAL_WARN_IF( !bFirstFound, "sw", "First not Found." );
+    SAL_WARN_IF( nCnt + aFreePositions.size() != Count(), "sw", "Lost Chain." );
+    SAL_WARN_IF(
+        Count() == nCurMax && nCurMax != aFreePositions.size() + nCnt, "sw",
         "Lost FreePositions." );
 }
 #endif
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 6a1f2bb..88fd062 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -1254,12 +1254,7 @@ static void lcl_CheckHiddenSection( SwNodeIndex& rIdx )
         SwNodeIndex aTmp( *pSectNd );
         const SwNode* pFrmNd =
         rIdx.GetNodes().FindPrvNxtFrmNode( aTmp, pSectNd->EndOfSectionNode() );
-
-#ifndef DBG_UTIL
-        (void) pFrmNd;
-#else
-        OSL_ENSURE( pFrmNd, "found no Node with Frames" );
-#endif
+        SAL_WARN_IF( !pFrmNd, "sw", "found no Node with Frames" );
         rIdx = aTmp;
     }
 }
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 5ca28ec..c68f85d 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -119,12 +119,12 @@ TYPEINIT1(SwRedlineHint, SfxHint);
             const SwRedline* pCurrent = rTbl[ n ];
 
             // check redline sorting
-            OSL_ENSURE( *pPrev->Start() <= *pCurrent->Start(),
-                        _ERROR_PREFIX "not sorted correctly" );
+            SAL_WARN_IF( *pPrev->Start() > *pCurrent->Start(), "sw",
+                         _ERROR_PREFIX "not sorted correctly" );
 
             // check for overlapping redlines
-            OSL_ENSURE( *pPrev->End() <= *pCurrent->Start(),
-                        _ERROR_PREFIX "overlapping redlines" );
+            SAL_WARN_IF( *pPrev->End() > *pCurrent->Start(), "sw",
+                         _ERROR_PREFIX "overlapping redlines" );
         }
     }
 
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index eeccc20..b049913 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1147,14 +1147,14 @@ void SwCntntFrm::MakeAll()
     const SwDoc *pDoc = GetAttrSet()->GetDoc();
     if( pDoc )
     {
-        static sal_Bool bWarn = sal_False;
+        static sal_Bool bWarned = sal_False;
         if( pDoc->InXMLExport() )
         {
-            OSL_ENSURE( bWarn, "Formatting during XML-export!" );
-            bWarn = sal_True;
+            SAL_WARN_IF( !bWarned, "sw", "Formatting during XML-export!" );
+            bWarned = sal_True;
         }
         else
-            bWarn = sal_False;
+            bWarned = sal_False;
     }
 #endif
 
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 940bc11..38e3ee8 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -3134,18 +3134,18 @@ SwSaveFtnHeight::~SwSaveFtnHeight()
 const SwCntntFrm* SwFtnFrm::GetRef() const
 {
     const SwCntntFrm* pRefAttr = GetRefFromAttr();
-    OSL_ENSURE( pRef == pRefAttr || pRef->IsAnFollow( pRefAttr )
-            || pRefAttr->IsAnFollow( pRef ),
-            "access to deleted Frame? pRef != pAttr->GetRef()" );
+    SAL_WARN_IF( pRef != pRefAttr && !pRef->IsAnFollow( pRefAttr )
+            && !pRefAttr->IsAnFollow( pRef ),
+            "sw", "access to deleted Frame? pRef != pAttr->GetRef()" );
     return pRef;
 }
 
 SwCntntFrm* SwFtnFrm::GetRef()
 {
     const SwCntntFrm* pRefAttr = GetRefFromAttr();
-    OSL_ENSURE( pRef == pRefAttr || pRef->IsAnFollow( pRefAttr )
-            || pRefAttr->IsAnFollow( pRef ),
-            "access to deleted Frame? pRef != pAttr->GetRef()" );
+    SAL_WARN_IF( pRef != pRefAttr && !pRef->IsAnFollow( pRefAttr )
+            && !pRefAttr->IsAnFollow( pRef ),
+            "sw", "access to deleted Frame? pRef != pAttr->GetRef()" );
     return pRef;
 }
 
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index 3f68127..76cb5ed 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -2121,22 +2121,22 @@ void SwTable::CheckConsistency() const
     {
         SwTwips nWidth = 0;
         SwTableLine* pLine = GetTabLines()[nCurrLine];
-        OSL_ENSURE( pLine, "Missing Table Line" );
+        SAL_WARN_IF( !pLine, "sw", "Missing Table Line" );
         sal_uInt16 nColCount = pLine->GetTabBoxes().Count();
-        OSL_ENSURE( nColCount, "Empty Table Line" );
+        SAL_WARN_IF( !nColCount, "sw", "Empty Table Line" );
         for( sal_uInt16 nCurrCol = 0; nCurrCol < nColCount; ++nCurrCol )
         {
             SwTableBox* pBox = pLine->GetTabBoxes()[nCurrCol];
-            OSL_ENSURE( pBox, "Missing Table Box" );
+            SAL_WARN_IF( !pBox, "sw", "Missing Table Box" );
             SwTwips nNewWidth = pBox->GetFrmFmt()->GetFrmSize().GetWidth() + nWidth;
             long nRowSp = pBox->getRowSpan();
             if( nRowSp < 0 )
             {
-                OSL_ENSURE( aIter != aRowSpanCells.end(), "Missing master box" );
-                OSL_ENSURE( aIter->nLeft == nWidth && aIter->nRight == nNewWidth,
-                    "Wrong position/size of overlapped table box" );
+                SAL_WARN_IF( aIter == aRowSpanCells.end(), "sw", "Missing master box" );
+                SAL_WARN_IF( aIter->nLeft != nWidth || aIter->nRight != nNewWidth,
+                    "sw", "Wrong position/size of overlapped table box" );
                 --(aIter->nRowSpan);
-                OSL_ENSURE( aIter->nRowSpan == -nRowSp, "Wrong row span value" );
+                SAL_WARN_IF( aIter->nRowSpan != -nRowSp, "sw", "Wrong row span value" );
                 if( nRowSp == -1 )
                 {
                     std::list< RowSpanCheck >::iterator aEraseIter = aIter;
@@ -2148,7 +2148,7 @@ void SwTable::CheckConsistency() const
             }
             else if( nRowSp != 1 )
             {
-                OSL_ENSURE( nRowSp, "Zero row span?!" );
+                SAL_WARN_IF( !nRowSp, "sw", "Zero row span?!" );
                 RowSpanCheck aEntry;
                 aEntry.nLeft = nWidth;
                 aEntry.nRight = nNewWidth;
@@ -2159,14 +2159,14 @@ void SwTable::CheckConsistency() const
         }
         if( !nCurrLine )
             nLineWidth = nWidth;
-        OSL_ENSURE( nWidth == nLineWidth, "Different Line Widths" );
-        OSL_ENSURE( nWidth == nTabSize, "Boxen der Line zu klein/gross" );
-        OSL_ENSURE( nWidth >= 0 && nWidth <= USHRT_MAX, "Width out of range" );
-        OSL_ENSURE( aIter == aRowSpanCells.end(), "Missing overlapped box" );
+        SAL_WARN_IF( nWidth != nLineWidth, "sw", "Different Line Widths" );
+        SAL_WARN_IF( nWidth != nTabSize, "sw", "Boxen der Line zu klein/gross" );
+        SAL_WARN_IF( nWidth < 0 || nWidth > USHRT_MAX, "sw", "Width out of range" );
+        SAL_WARN_IF( aIter != aRowSpanCells.end(), "sw", "Missing overlapped box" );
         aIter = aRowSpanCells.begin();
     }
     bool bEmpty = aRowSpanCells.empty();
-    OSL_ENSURE( bEmpty, "Open row span detected" );
+    SAL_WARN_IF( !bEmpty, "sw", "Open row span detected" );
 }
 
 #endif
diff --git a/sw/source/core/text/txtio.cxx b/sw/source/core/text/txtio.cxx
index c55a166..618c7a0 100644
--- a/sw/source/core/text/txtio.cxx
+++ b/sw/source/core/text/txtio.cxx
@@ -78,9 +78,7 @@ sal_Bool IsDbg( const SwTxtFrm *pFrm )
 
 static void Error()
 {
-    // wegen PM und BCC
-    sal_Bool bFalse = sal_False;
-    OSL_ENSURE( bFalse, "txtio: No debug version" );
+    SAL_WARN( "sw", "txtio: No debug version" );
 }
 
 #define IMPL_OUTOP(class) \
diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx
index 7d2c0ee..1b7a906 100644
--- a/sw/source/filter/writer/wrtswtbl.cxx
+++ b/sw/source/filter/writer/wrtswtbl.cxx
@@ -131,7 +131,7 @@ long SwWriteTable::GetLineHeight( const SwTableLine *pLine )
         bUseLayoutHeights = bLayoutAvailable; /*sal_False;*/
 
 #ifdef DBG_UTIL
-        OSL_ENSURE( bLayoutAvailable || !bOldGetLineHeightCalled, "Layout ungueltig?" );
+        SAL_WARN_IF( !bLayoutAvailable && bOldGetLineHeightCalled, "sw", "Layout ungueltig?" );
 #endif
     }
 


More information about the Libreoffice-commits mailing list