[PATCH] turn some OSL_ENSURE into SAL_WARN_IF to avoid warnings abou...

Matúš Kukan (via_Code_Review) gerrit at gerrit.libreoffice.org
Tue Jan 8 12:07:25 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1600

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/00/1600/1

turn some OSL_ENSURE into SAL_WARN_IF to avoid warnings about unused variables

And one OSL_ASSERT too.

Change-Id: I51f0083b9b9336e80c3b6a898c295173ad48f77c
---
M forms/source/component/errorbroadcaster.cxx
M sc/source/filter/oox/stylesbuffer.cxx
M slideshow/source/engine/transitions/fanwipe.cxx
3 files changed, 19 insertions(+), 19 deletions(-)



diff --git a/forms/source/component/errorbroadcaster.cxx b/forms/source/component/errorbroadcaster.cxx
index 8c8baac..a94efd6 100644
--- a/forms/source/component/errorbroadcaster.cxx
+++ b/forms/source/component/errorbroadcaster.cxx
@@ -45,11 +45,11 @@
     //---------------------------------------------------------------------
     OErrorBroadcaster::~OErrorBroadcaster( )
     {
-        OSL_ENSURE( m_rBHelper.bDisposed || m_rBHelper.bInDispose,
+        SAL_WARN_IF( !m_rBHelper.bDisposed && !m_rBHelper.bInDispose, "forms",
             "OErrorBroadcaster::~OErrorBroadcaster: not disposed!" );
         // herein, we don't have a chance to do the dispose ourself ....
 
-        OSL_ENSURE( 0 == m_aErrorListeners.getLength(),
+        SAL_WARN_IF( m_aErrorListeners.getLength(), "forms",
             "OErrorBroadcaster::~OErrorBroadcaster: still have listeners!" );
         // either we're not disposed, or the derived class did not call our dispose from within their dispose
     }
diff --git a/sc/source/filter/oox/stylesbuffer.cxx b/sc/source/filter/oox/stylesbuffer.cxx
index b7cc8db..58b9a7f 100644
--- a/sc/source/filter/oox/stylesbuffer.cxx
+++ b/sc/source/filter/oox/stylesbuffer.cxx
@@ -773,7 +773,7 @@
 
 void Font::importFont( SequenceInputStream& rStrm )
 {
-    OSL_ENSURE( !mbDxf, "Font::importFont - unexpected conditional formatting flag" );
+    SAL_WARN_IF( mbDxf, "sc", "Font::importFont - unexpected conditional formatting flag" );
 
     sal_uInt16 nHeight, nFlags, nWeight, nEscapement;
     sal_uInt8 nUnderline, nFamily, nCharSet, nScheme;
@@ -798,56 +798,56 @@
 
 void Font::importDxfName( SequenceInputStream& rStrm )
 {
-    OSL_ENSURE( mbDxf, "Font::importDxfName - missing conditional formatting flag" );
+    SAL_WARN_IF( !mbDxf, "sc", "Font::importDxfName - missing conditional formatting flag" );
     maModel.maName = BiffHelper::readString( rStrm, false );
     maUsedFlags.mbColorUsed = true;
 }
 
 void Font::importDxfColor( SequenceInputStream& rStrm )
 {
-    OSL_ENSURE( mbDxf, "Font::importDxfColor - missing conditional formatting flag" );
+    SAL_WARN_IF( !mbDxf, "sc", "Font::importDxfColor - missing conditional formatting flag" );
     rStrm >> maModel.maColor;
     maUsedFlags.mbColorUsed = true;
 }
 
 void Font::importDxfScheme( SequenceInputStream& rStrm )
 {
-    OSL_ENSURE( mbDxf, "Font::importDxfScheme - missing conditional formatting flag" );
+    SAL_WARN_IF( !mbDxf, "sc", "Font::importDxfScheme - missing conditional formatting flag" );
     maModel.setBiff12Scheme( rStrm.readuInt8() );
     maUsedFlags.mbSchemeUsed = true;
 }
 
 void Font::importDxfHeight( SequenceInputStream& rStrm )
 {
-    OSL_ENSURE( mbDxf, "Font::importDxfHeight - missing conditional formatting flag" );
+    SAL_WARN_IF( !mbDxf, "sc", "Font::importDxfHeight - missing conditional formatting flag" );
     maModel.setBiffHeight( rStrm.readuInt16() );
     maUsedFlags.mbHeightUsed = true;
 }
 
 void Font::importDxfWeight( SequenceInputStream& rStrm )
 {
-    OSL_ENSURE( mbDxf, "Font::importDxfWeight - missing conditional formatting flag" );
+    SAL_WARN_IF( !mbDxf, "sc", "Font::importDxfWeight - missing conditional formatting flag" );
     maModel.setBiffWeight( rStrm.readuInt16() );
     maUsedFlags.mbWeightUsed = true;
 }
 
 void Font::importDxfUnderline( SequenceInputStream& rStrm )
 {
-    OSL_ENSURE( mbDxf, "Font::importDxfUnderline - missing conditional formatting flag" );
+    SAL_WARN_IF( !mbDxf, "sc", "Font::importDxfUnderline - missing conditional formatting flag" );
     maModel.setBiffUnderline( rStrm.readuInt16() );
     maUsedFlags.mbUnderlineUsed = true;
 }
 
 void Font::importDxfEscapement( SequenceInputStream& rStrm )
 {
-    OSL_ENSURE( mbDxf, "Font::importDxfEscapement - missing conditional formatting flag" );
+    SAL_WARN_IF( !mbDxf, "sc", "Font::importDxfEscapement - missing conditional formatting flag" );
     maModel.setBiffEscapement( rStrm.readuInt16() );
     maUsedFlags.mbEscapementUsed = true;
 }
 
 void Font::importDxfFlag( sal_Int32 nElement, SequenceInputStream& rStrm )
 {
-    OSL_ENSURE( mbDxf, "Font::importDxfFlag - missing conditional formatting flag" );
+    SAL_WARN_IF( !mbDxf, "sc", "Font::importDxfFlag - missing conditional formatting flag" );
     bool bFlag = rStrm.readuInt8() != 0;
     switch( nElement )
     {
@@ -1675,7 +1675,7 @@
 
 void Border::importDxfBorder( sal_Int32 nElement, SequenceInputStream& rStrm )
 {
-    OSL_ENSURE( mbDxf, "Border::importDxfBorder - missing conditional formatting flag" );
+    SAL_WARN_IF( !mbDxf, "sc", "Border::importDxfBorder - missing conditional formatting flag" );
     if( BorderLineModel* pBorderLine = getBorderLine( nElement ) )
     {
         sal_uInt16 nStyle;
@@ -1977,7 +1977,7 @@
 
 void Fill::importFill( SequenceInputStream& rStrm )
 {
-    OSL_ENSURE( !mbDxf, "Fill::importFill - unexpected conditional formatting flag" );
+    SAL_WARN_IF( mbDxf, "sc", "Fill::importFill - unexpected conditional formatting flag" );
     sal_Int32 nPattern = rStrm.readInt32();
     if( nPattern == BIFF12_FILL_GRADIENT )
     {
@@ -1999,7 +1999,7 @@
 
 void Fill::importDxfPattern( SequenceInputStream& rStrm )
 {
-    OSL_ENSURE( mbDxf, "Fill::importDxfPattern - missing conditional formatting flag" );
+    SAL_WARN_IF( !mbDxf, "sc", "Fill::importDxfPattern - missing conditional formatting flag" );
     if( !mxPatternModel )
         mxPatternModel.reset( new PatternFillModel( mbDxf ) );
     mxPatternModel->setBiffPattern( rStrm.readuInt8() );
@@ -2008,7 +2008,7 @@
 
 void Fill::importDxfFgColor( SequenceInputStream& rStrm )
 {
-    OSL_ENSURE( mbDxf, "Fill::importDxfFgColor - missing conditional formatting flag" );
+    SAL_WARN_IF( !mbDxf, "sc", "Fill::importDxfFgColor - missing conditional formatting flag" );
     if( !mxPatternModel )
         mxPatternModel.reset( new PatternFillModel( mbDxf ) );
     mxPatternModel->maPatternColor.importColor( rStrm );
@@ -2017,7 +2017,7 @@
 
 void Fill::importDxfBgColor( SequenceInputStream& rStrm )
 {
-    OSL_ENSURE( mbDxf, "Fill::importDxfBgColor - missing conditional formatting flag" );
+    SAL_WARN_IF( !mbDxf, "sc", "Fill::importDxfBgColor - missing conditional formatting flag" );
     if( !mxPatternModel )
         mxPatternModel.reset( new PatternFillModel( mbDxf ) );
     mxPatternModel->maFillColor.importColor( rStrm );
@@ -2026,7 +2026,7 @@
 
 void Fill::importDxfGradient( SequenceInputStream& rStrm )
 {
-    OSL_ENSURE( mbDxf, "Fill::importDxfGradient - missing conditional formatting flag" );
+    SAL_WARN_IF( !mbDxf, "sc", "Fill::importDxfGradient - missing conditional formatting flag" );
     if( !mxGradientModel )
         mxGradientModel.reset( new GradientFillModel );
     mxGradientModel->readGradient( rStrm );
@@ -2034,7 +2034,7 @@
 
 void Fill::importDxfStop( SequenceInputStream& rStrm )
 {
-    OSL_ENSURE( mbDxf, "Fill::importDxfStop - missing conditional formatting flag" );
+    SAL_WARN_IF( !mbDxf, "sc", "Fill::importDxfStop - missing conditional formatting flag" );
     if( !mxGradientModel )
         mxGradientModel.reset( new GradientFillModel );
     mxGradientModel->readGradientStop( rStrm, true );
diff --git a/slideshow/source/engine/transitions/fanwipe.cxx b/slideshow/source/engine/transitions/fanwipe.cxx
index fd3792c..dc102ff 100644
--- a/slideshow/source/engine/transitions/fanwipe.cxx
+++ b/slideshow/source/engine/transitions/fanwipe.cxx
@@ -51,7 +51,7 @@
     }
     else
     {
-        OSL_ASSERT( ! m_fanIn );
+        SAL_WARN_IF( m_fanIn, "slideshow", "FanWipe: m_fanIn is true ?" );
         res.transform(basegfx::tools::createScaleTranslateB2DHomMatrix(0.5, 1.0, 0.5, 1.0));
     }
     return res;

-- 
To view, visit https://gerrit.libreoffice.org/1600
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I51f0083b9b9336e80c3b6a898c295173ad48f77c
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Matúš Kukan <matus.kukan at gmail.com>



More information about the LibreOffice mailing list