[Libreoffice-commits] core.git: sc/source

Stephan Bergmann sbergman at redhat.com
Fri Oct 11 09:24:48 PDT 2013


 sc/source/filter/excel/xistring.cxx       |    4 +
 sc/source/filter/oox/condformatbuffer.cxx |   65 +++++++++++++++++++++++-------
 sc/source/filter/oox/pivotcachebuffer.cxx |    8 ++-
 sc/source/filter/oox/pivottablebuffer.cxx |   12 +++--
 4 files changed, 67 insertions(+), 22 deletions(-)

New commits:
commit dbad3d0e6e972e76484e36ab48513730ca4db1eb
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Oct 11 18:24:12 2013 +0200

    -Werror,-Wunused-variable
    
    Change-Id: Ia69312b4adc11c256e57e69c0fd488eca441ce4e

diff --git a/sc/source/filter/excel/xistring.cxx b/sc/source/filter/excel/xistring.cxx
index e03c3a8..6bb003f 100644
--- a/sc/source/filter/excel/xistring.cxx
+++ b/sc/source/filter/excel/xistring.cxx
@@ -47,7 +47,9 @@ void XclImpString::Read( XclImpStream& rStrm, XclStrFlags nFlags )
     if( !::get_flag( nFlags, EXC_STR_SEPARATEFORMATS ) )
         maFormats.clear();
 
-    OSL_ENSURE( (nFlags & ~nAllowedFlags) == 0, "XclImpString::Read - unknown flag" );
+    SAL_WARN_IF(
+        (nFlags & ~nAllowedFlags) != 0, "sc.filter",
+        "XclImpString::Read - unknown flag");
     bool b16BitLen = !::get_flag( nFlags, EXC_STR_8BITLENGTH );
 
     switch( rStrm.GetRoot().GetBiff() )
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index aa31edd..d14ff5d 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -482,7 +482,9 @@ void CondFormatRule::importCfRule( SequenceInputStream& rStrm )
     switch( nType )
     {
         case BIFF12_CFRULE_TYPE_CELLIS:
-            OSL_ENSURE( nSubType == BIFF12_CFRULE_SUB_CELLIS, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
+            SAL_WARN_IF(
+                nSubType != BIFF12_CFRULE_SUB_CELLIS, "sc.filter",
+                "CondFormatRule::importCfRule - rule type/subtype mismatch");
             maModel.mnType = XML_cellIs;
             maModel.setBiffOperator( nOperator );
             OSL_ENSURE( maModel.mnOperator != XML_TOKEN_INVALID, "CondFormatRule::importCfRule - unknown operator" );
@@ -520,52 +522,77 @@ void CondFormatRule::importCfRule( SequenceInputStream& rStrm )
                     maModel.mnType = XML_notContainsErrors;
                 break;
                 case BIFF12_CFRULE_SUB_TODAY:
-                    OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_TODAY, "CondFormatRule::importCfRule - unexpected time operator value" );
+                    SAL_WARN_IF(
+                        nOperator != BIFF12_CFRULE_TIMEOP_TODAY, "sc.filter",
+                        "CondFormatRule::importCfRule - unexpected time operator value");
                     maModel.mnType = XML_timePeriod;
                     maModel.mnTimePeriod = XML_today;
                 break;
                 case BIFF12_CFRULE_SUB_TOMORROW:
-                    OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_TOMORROW, "CondFormatRule::importCfRule - unexpected time operator value" );
+                    SAL_WARN_IF(
+                        nOperator != BIFF12_CFRULE_TIMEOP_TOMORROW, "sc.filter",
+                        "CondFormatRule::importCfRule - unexpected time operator value");
                     maModel.mnType = XML_timePeriod;
                     maModel.mnTimePeriod = XML_tomorrow;
                 break;
                 case BIFF12_CFRULE_SUB_YESTERDAY:
-                    OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_YESTERDAY, "CondFormatRule::importCfRule - unexpected time operator value" );
+                    SAL_WARN_IF(
+                        nOperator != BIFF12_CFRULE_TIMEOP_YESTERDAY,
+                        "sc.filter",
+                        "CondFormatRule::importCfRule - unexpected time operator value");
                     maModel.mnType = XML_timePeriod;
                     maModel.mnTimePeriod = XML_yesterday;
                 break;
                 case BIFF12_CFRULE_SUB_LAST7DAYS:
-                    OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_LAST7DAYS, "CondFormatRule::importCfRule - unexpected time operator value" );
+                    SAL_WARN_IF(
+                        nOperator != BIFF12_CFRULE_TIMEOP_LAST7DAYS,
+                        "sc.filter",
+                        "CondFormatRule::importCfRule - unexpected time operator value");
                     maModel.mnType = XML_timePeriod;
                     maModel.mnTimePeriod = XML_last7Days;
                 break;
                 case BIFF12_CFRULE_SUB_LASTMONTH:
-                    OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_LASTMONTH, "CondFormatRule::importCfRule - unexpected time operator value" );
+                    SAL_WARN_IF(
+                        nOperator != BIFF12_CFRULE_TIMEOP_LASTMONTH,
+                        "sc.filter",
+                        "CondFormatRule::importCfRule - unexpected time operator value");
                     maModel.mnType = XML_timePeriod;
                     maModel.mnTimePeriod = XML_lastMonth;
                 break;
                 case BIFF12_CFRULE_SUB_NEXTMONTH:
-                    OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_NEXTMONTH, "CondFormatRule::importCfRule - unexpected time operator value" );
+                    SAL_WARN_IF(
+                        nOperator != BIFF12_CFRULE_TIMEOP_NEXTMONTH,
+                        "sc.filter",
+                        "CondFormatRule::importCfRule - unexpected time operator value");
                     maModel.mnType = XML_timePeriod;
                     maModel.mnTimePeriod = XML_nextMonth;
                 break;
                 case BIFF12_CFRULE_SUB_THISWEEK:
-                    OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_THISWEEK, "CondFormatRule::importCfRule - unexpected time operator value" );
+                    SAL_WARN_IF(
+                        nOperator != BIFF12_CFRULE_TIMEOP_THISWEEK, "sc.filter",
+                        "CondFormatRule::importCfRule - unexpected time operator value");
                     maModel.mnType = XML_timePeriod;
                     maModel.mnTimePeriod = XML_thisWeek;
                 break;
                 case BIFF12_CFRULE_SUB_NEXTWEEK:
-                    OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_NEXTWEEK, "CondFormatRule::importCfRule - unexpected time operator value" );
+                    SAL_WARN_IF(
+                        nOperator != BIFF12_CFRULE_TIMEOP_NEXTWEEK, "sc.filter",
+                        "CondFormatRule::importCfRule - unexpected time operator value");
                     maModel.mnType = XML_timePeriod;
                     maModel.mnTimePeriod = XML_nextWeek;
                 break;
                 case BIFF12_CFRULE_SUB_LASTWEEK:
-                    OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_LASTWEEK, "CondFormatRule::importCfRule - unexpected time operator value" );
+                    SAL_WARN_IF(
+                        nOperator != BIFF12_CFRULE_TIMEOP_LASTWEEK, "sc.filter",
+                        "CondFormatRule::importCfRule - unexpected time operator value");
                     maModel.mnType = XML_timePeriod;
                     maModel.mnTimePeriod = XML_lastWeek;
                 break;
                 case BIFF12_CFRULE_SUB_THISMONTH:
-                    OSL_ENSURE( nOperator == BIFF12_CFRULE_TIMEOP_THISMONTH, "CondFormatRule::importCfRule - unexpected time operator value" );
+                    SAL_WARN_IF(
+                        nOperator != BIFF12_CFRULE_TIMEOP_THISMONTH,
+                        "sc.filter",
+                        "CondFormatRule::importCfRule - unexpected time operator value");
                     maModel.mnType = XML_timePeriod;
                     maModel.mnTimePeriod = XML_thisMonth;
                 break;
@@ -604,22 +631,30 @@ void CondFormatRule::importCfRule( SequenceInputStream& rStrm )
             }
         break;
         case BIFF12_CFRULE_TYPE_COLORSCALE:
-            OSL_ENSURE( nSubType == BIFF12_CFRULE_SUB_COLORSCALE, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
+            SAL_WARN_IF(
+                nSubType != BIFF12_CFRULE_SUB_COLORSCALE, "sc.filter",
+                "CondFormatRule::importCfRule - rule type/subtype mismatch");
             OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
             maModel.mnType = XML_colorScale;
         break;
         case BIFF12_CFRULE_TYPE_DATABAR:
-            OSL_ENSURE( nSubType == BIFF12_CFRULE_SUB_DATABAR, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
+            SAL_WARN_IF(
+                nSubType != BIFF12_CFRULE_SUB_DATABAR, "sc.filter",
+                "CondFormatRule::importCfRule - rule type/subtype mismatch");
             OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
             maModel.mnType = XML_dataBar;
         break;
         case BIFF12_CFRULE_TYPE_TOPTEN:
-            OSL_ENSURE( nSubType == BIFF12_CFRULE_SUB_TOPTEN, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
+            SAL_WARN_IF(
+                nSubType != BIFF12_CFRULE_SUB_TOPTEN, "sc.filter",
+                "CondFormatRule::importCfRule - rule type/subtype mismatch");
             maModel.mnType = XML_top10;
             maModel.mnRank = nOperator;   // operator field used for rank value
         break;
         case BIFF12_CFRULE_TYPE_ICONSET:
-            OSL_ENSURE( nSubType == BIFF12_CFRULE_SUB_ICONSET, "CondFormatRule::importCfRule - rule type/subtype mismatch" );
+            SAL_WARN_IF(
+                nSubType != BIFF12_CFRULE_SUB_ICONSET, "sc.filter",
+                "CondFormatRule::importCfRule - rule type/subtype mismatch");
             OSL_ENSURE( nOperator == 0, "CondFormatRule::importCfRule - unexpected operator value" );
             maModel.mnType = XML_iconSet;
         break;
diff --git a/sc/source/filter/oox/pivotcachebuffer.cxx b/sc/source/filter/oox/pivotcachebuffer.cxx
index e595bfd..8b3c155 100644
--- a/sc/source/filter/oox/pivotcachebuffer.cxx
+++ b/sc/source/filter/oox/pivotcachebuffer.cxx
@@ -663,7 +663,9 @@ void PivotCacheField::importPCDField( BiffInputStream& rStrm )
     // read group items, if any
     if( nGroupItems > 0 )
     {
-        OSL_ENSURE( getFlag( nFlags, BIFF_PCDFIELD_HASITEMS ), "PivotCacheField::importPCDField - missing items flag" );
+        SAL_WARN_IF(
+            !getFlag(nFlags, BIFF_PCDFIELD_HASITEMS), "sc.filter",
+            "PivotCacheField::importPCDField - missing items flag");
         maGroupItems.importItemList( rStrm, nGroupItems );
 
         sal_uInt16 nNextRecId = rStrm.getNextRecId();
@@ -681,7 +683,9 @@ void PivotCacheField::importPCDField( BiffInputStream& rStrm )
     // read the shared items, if any
     if( nSharedItems > 0 )
     {
-        OSL_ENSURE( getFlag( nFlags, BIFF_PCDFIELD_HASITEMS ), "PivotCacheField::importPCDField - missing items flag" );
+        SAL_WARN_IF(
+            !getFlag(nFlags, BIFF_PCDFIELD_HASITEMS), "sc.filter",
+            "PivotCacheField::importPCDField - missing items flag");
         maSharedItems.importItemList( rStrm, nSharedItems );
     }
 }
diff --git a/sc/source/filter/oox/pivottablebuffer.cxx b/sc/source/filter/oox/pivottablebuffer.cxx
index 05519ad..c0e73ba 100644
--- a/sc/source/filter/oox/pivottablebuffer.cxx
+++ b/sc/source/filter/oox/pivottablebuffer.cxx
@@ -838,8 +838,10 @@ void PivotTableFilter::importTop10Filter( SequenceInputStream& rStrm )
     sal_uInt8 nFlags;
     rStrm >> nFlags >> maModel.mfValue;
 
-    OSL_ENSURE( getFlag( nFlags, BIFF12_TOP10FILTER_PERCENT ) == (maModel.mnType == XML_percent),
-        "PivotTableFilter::importTop10 - unexpected value of percent attribute" );
+    SAL_WARN_IF(
+        getFlag(nFlags, BIFF12_TOP10FILTER_PERCENT) != (maModel.mnType == XML_percent),
+        "sc.filter",
+        "PivotTableFilter::importTop10 - unexpected value of percent attribute");
     maModel.mbTopFilter = getFlag( nFlags, BIFF12_TOP10FILTER_TOP );
 }
 
@@ -1048,8 +1050,10 @@ void PivotTable::importPTDefinition( SequenceInputStream& rStrm )
     if( getFlag( nFlags3, BIFF12_PTDEF_HASROWHEADERCAPTION ) )
         rStrm >> maDefModel.maRowHeaderCaption;
 
-    OSL_ENSURE( (nDataAxis == BIFF12_PTDEF_ROWAXIS) || (nDataAxis == BIFF12_PTDEF_COLAXIS),
-        "PivotTable::importPTDefinition - unexpected axis position for data field" );
+    SAL_WARN_IF(
+        (nDataAxis != BIFF12_PTDEF_ROWAXIS) && (nDataAxis != BIFF12_PTDEF_COLAXIS),
+        "sc.filter",
+        "PivotTable::importPTDefinition - unexpected axis position for data field");
 
     maDefModel.mnIndent              = extractValue< sal_uInt8 >( nFlags1, 24, 7 );
     maDefModel.mbDataOnRows          = nDataAxis == BIFF12_PTDEF_ROWAXIS;


More information about the Libreoffice-commits mailing list