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

Rohan Kumar rohankanojia420 at gmail.com
Fri Mar 4 20:11:20 UTC 2016


 sc/inc/attarray.hxx                                 |    4 +++-
 sc/source/core/data/attarray.cxx                    |   12 ++++++------
 sc/source/core/data/column.cxx                      |    6 +++---
 sc/source/core/data/dptabres.cxx                    |   12 +++++-------
 sc/source/core/inc/parclass.hxx                     |    6 ++++--
 sc/source/core/tool/interpr2.cxx                    |    2 +-
 sc/source/core/tool/interpr5.cxx                    |    6 +++---
 sc/source/core/tool/parclass.cxx                    |   13 ++++---------
 sc/source/core/tool/token.cxx                       |    4 ++--
 sc/source/filter/excel/excimp8.cxx                  |    2 +-
 sc/source/filter/excel/xltoolbar.cxx                |   10 +++++-----
 sc/source/filter/excel/xltoolbar.hxx                |   10 +++++-----
 sc/source/filter/qpro/biff.cxx                      |    2 +-
 sc/source/filter/xml/XMLStylesExportHelper.cxx      |    3 ---
 sc/source/filter/xml/xmlbodyi.cxx                   |    5 +----
 sc/source/ui/Accessibility/DrawModelBroadcaster.cxx |    6 +-----
 16 files changed, 45 insertions(+), 58 deletions(-)

New commits:
commit 5f164b6e01496655ee0616e16d251e066d99ea73
Author: Rohan Kumar <rohankanojia420 at gmail.com>
Date:   Sat Mar 5 00:23:12 2016 +0530

    tdf#91794 remove OSL_DEBUG_LEVEL > 1 conditionals
    
    I made small changes to disable some test code conditionally by adding a few
    new debug macros.
    
    Change-Id: Ieaf6f1b29343fb896cc64163a116c629165e8db3
    Reviewed-on: https://gerrit.libreoffice.org/22711
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index bf6a916..2be8e55 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -44,6 +44,8 @@ namespace editeng { class SvxBorderLine; }
 
 #define SC_ATTRARRAY_DELTA      4
 
+#define DEBUG_SC_TESTATTRARRAY 0
+
 struct ScLineFlags
 {
     sal_uInt8   nLeft;
@@ -104,7 +106,7 @@ public:
 
     void    SetTab(SCTAB nNewTab)   { nTab = nNewTab; }
     void    SetCol(SCCOL nNewCol)   { nCol = nNewCol; }
-#if OSL_DEBUG_LEVEL > 1
+#if DEBUG_SC_TESTATTRARRAY
     void    TestData() const;
 #endif
     void    Reset( const ScPatternAttr* pPattern);
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 8839444..d97b7e2 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -63,7 +63,7 @@ ScAttrArray::ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc ) :
 
 ScAttrArray::~ScAttrArray()
 {
-#if OSL_DEBUG_LEVEL > 1
+#if DEBUG_SC_TESTATTRARRAY
     TestData();
 #endif
 
@@ -74,7 +74,7 @@ ScAttrArray::~ScAttrArray()
     delete[] pData;
 }
 
-#if OSL_DEBUG_LEVEL > 1
+#if DEBUG_SC_TESTATTRARRAY
 void ScAttrArray::TestData() const
 {
 
@@ -555,7 +555,7 @@ void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPattern
         }
     }
 
-#if OSL_DEBUG_LEVEL > 1
+#if DEBUG_SC_TESTATTRARRAY
     TestData();
 #endif
 }
@@ -628,7 +628,7 @@ void ScAttrArray::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, ScStyleSheet*
             pDocument->SetStreamValid(nTab, false);
     }
 
-#if OSL_DEBUG_LEVEL > 1
+#if DEBUG_SC_TESTATTRARRAY
     TestData();
 #endif
 }
@@ -778,7 +778,7 @@ void ScAttrArray::ApplyLineStyleArea( SCROW nStartRow, SCROW nEndRow,
 
 void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache, ScEditDataArray* pDataArray )
 {
-#if OSL_DEBUG_LEVEL > 1
+#if DEBUG_SC_TESTATTRARRAY
     TestData();
 #endif
 
@@ -850,7 +850,7 @@ void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCac
             pDocument->SetStreamValid(nTab, false);
     }
 
-#if OSL_DEBUG_LEVEL > 1
+#if DEBUG_SC_TESTATTRARRAY
     TestData();
 #endif
 }
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 4c94bab..0bfb0fe 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2792,19 +2792,19 @@ struct CalcAllHandler
 {
     void operator() (size_t /*nRow*/, ScFormulaCell* pCell)
     {
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
         // after F9 ctrl-F9: check the calculation for each FormulaTree
         double nOldVal, nNewVal;
         nOldVal = pCell->GetValue();
 #endif
         pCell->Interpret();
-#if OSL_DEBUG_LEVEL > 1
+#if OSL_DEBUG_LEVEL > 0
         if (pCell->GetCode()->IsRecalcModeNormal())
             nNewVal = pCell->GetValue();
         else
             nNewVal = nOldVal;  // random(), jetzt() etc.
 
-        OSL_ENSURE(nOldVal == nNewVal, "CalcAll: nOldVal != nNewVal");
+        assert(nOldVal == nNewVal);
 #endif
     }
 };
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 2078cf6..a7f96e3 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -2880,10 +2880,10 @@ void ScDPResultDimension::LateInitFrom(
     {
         ResultMembers* pMembers = pResultData->GetDimResultMembers(nDimSource, pThisDim, pThisLevel);
         bLateInitAllMembers = pMembers->IsHasHideDetailsMembers();
-#if OSL_DEBUG_LEVEL > 1
-        OSL_TRACE( "%s", OUStringToOString(aDimensionName, RTL_TEXTENCODING_UTF8).getStr() );
+#if OSL_DEBUG_LEVEL > 0
+        SAL_INFO("sc.data", aDimensionName);
         if ( pMembers->IsHasHideDetailsMembers() )
-            OSL_TRACE( "HasHideDetailsMembers" );
+            SAL_INFO("sc.data", "HasHideDetailsMembers");
 #endif
         pMembers->SetHasHideDetailsMembers( false );
     }
@@ -2979,10 +2979,8 @@ bool ScDPResultDimension::IsValidEntry( const vector< SCROW >& aMembers ) const
     const ScDPResultMember* pMember = FindMember( aMembers[0] );
     if ( nullptr != pMember )
         return pMember->IsValidEntry( aMembers );
-#if OSL_DEBUG_LEVEL > 1
-    OStringBuffer strTemp("IsValidEntry: Member not found, DimName = ");
-    strTemp.append(OUStringToOString(GetName(), RTL_TEXTENCODING_UTF8));
-    OSL_TRACE("%s", strTemp.getStr());
+#if OSL_DEBUG_LEVEL > 0
+    SAL_INFO("sc.data", "IsValidEntry: Member not found, DimNam = "  << GetName());
 #endif
     return false;
 }
diff --git a/sc/source/core/inc/parclass.hxx b/sc/source/core/inc/parclass.hxx
index aa1b074..4df70f0 100644
--- a/sc/source/core/inc/parclass.hxx
+++ b/sc/source/core/inc/parclass.hxx
@@ -23,6 +23,8 @@
 #include <formula/opcode.hxx>
 #include <sys/types.h>
 
+#define DEBUG_SC_PARCLASSDOC 0
+
 namespace formula
 {
     class FormulaToken;
@@ -123,7 +125,7 @@ private:
     static  Type                GetExternalParameterType(
                                     const formula::FormulaToken* pToken, sal_uInt16 nParameter);
 
-#if OSL_DEBUG_LEVEL > 1
+#if DEBUG_SC_PARCLASSDOC
     // Generate documentation to stdout if environment variable
     // OOO_CALC_GENPARCLASSDOC is set.
     static  void                GenerateDocumentation();
@@ -161,7 +163,7 @@ private:
                                         return eOp <= SC_OPCODE_LAST_OPCODE_ID
                                             && pData[eOp].aData.nRepeatLast > 0;
                                     }
-#endif // OSL_DEBUG_LEVEL
+#endif // DEBUG_SC_PARCLASSDOC
 };
 
 #endif // INCLUDED_SC_SOURCE_CORE_INC_PARCLASS_HXX
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 7127028..8781b0b 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -2588,7 +2588,7 @@ void ScInterpreter::ScBase()
 // a little bit better:
                     double fInt = ::rtl::math::approxFloor( fVal / fBase );
                     double fMult = fInt * fBase;
-#if OSL_DEBUG_LEVEL > 1
+#if 0
                     // =BASIS(1e308;36) => GPF with
                     // nDig = (size_t) ::rtl::math::approxFloor( fVal - fMult );
                     // in spite off previous test if fVal >= fMult
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index a32f2de..f9e1bde 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -21,7 +21,7 @@
 #include <string.h>
 #include <math.h>
 
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DEBUG_SC_LUP_DECOMPOSITION
 #include <stdio.h>
 #endif
 
@@ -716,7 +716,7 @@ static int lcl_LUP_decompose( ScMatrix* mA, const SCSIZE n,
                             fNum * mA->GetDouble( j, k) ) / fDen, j, i);
         }
     }
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DEBUG_SC_LUP_DECOMPOSITION
     fprintf( stderr, "\n%s\n", "lcl_LUP_decompose(): LU");
     for (SCSIZE i=0; i < n; ++i)
     {
@@ -953,7 +953,7 @@ void ScInterpreter::ScMatInv()
                         for (SCSIZE i=0; i < nR; ++i)
                             xY->PutDouble( X[i], j, i);
                     }
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DEBUG_SC_LUP_DECOMPOSITION
                     /* Possible checks for ill-condition:
                      * 1. Scale matrix, invert scaled matrix. If there are
                      *    elements of the inverted matrix that are several
diff --git a/sc/source/core/tool/parclass.cxx b/sc/source/core/tool/parclass.cxx
index bad5c65..d30c311 100644
--- a/sc/source/core/tool/parclass.cxx
+++ b/sc/source/core/tool/parclass.cxx
@@ -28,7 +28,7 @@
 #include <sal/macros.h>
 #include <string.h>
 
-#if OSL_DEBUG_LEVEL > 1
+#if DEBUG_SC_PARCLASSDOC
 // the documentation thingy
 #include <com/sun/star/sheet/FormulaLanguage.hpp>
 #include <rtl/strbuf.hxx>
@@ -252,12 +252,7 @@ void ScParameterClassification::Init()
         else
         {
             RunData* pRun = &pData[ pRaw->eOp ];
-#if OSL_DEBUG_LEVEL > 1
-            if ( pRun->aData.nParam[0] != Unknown )
-            {
-                OSL_TRACE( "already assigned: %d", pRaw->eOp);
-            }
-#endif
+            SAL_WARN_IF(pRun->aData.nParam[0] != Unknown,  "sc.core", "already assigned: " << (int)pRaw->eOp);
             memcpy( &(pRun->aData), &(pRaw->aData), sizeof(CommonData));
             // fill 0-initialized fields with real values
             if ( pRun->aData.nRepeatLast )
@@ -305,7 +300,7 @@ void ScParameterClassification::Init()
         }
     }
 
-#if OSL_DEBUG_LEVEL > 1
+#if DEBUG_SC_PARCLASSDOC
     GenerateDocumentation();
 #endif
 }
@@ -429,7 +424,7 @@ ScParameterClassification::GetExternalParameterType( const formula::FormulaToken
     return eRet;
 }
 
-#if OSL_DEBUG_LEVEL > 1
+#if DEBUG_SC_PARCLASSDOC
 
 // add remaining functions, all Value parameters
 void ScParameterClassification::MergeArgumentsFromFunctionResource()
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index abee22c..a6251e5 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -372,8 +372,8 @@ bool ScRawToken::IsValidReference() const
 
 FormulaToken* ScRawToken::CreateToken() const
 {
-#if OSL_DEBUG_LEVEL > 1
-#define IF_NOT_OPCODE_ERROR(o,c) if (eOp!=o) OSL_TRACE( #c "::ctor: OpCode %d lost, converted to " #o "; maybe inherit from FormulaToken instead!", int(eOp))
+#if OSL_DEBUG_LEVEL > 0
+#define IF_NOT_OPCODE_ERROR(o,c) if (eOp!=o) SAL_INFO( "sc.tool", #c "::ctor: OpCode " << (int)eOp << " lost, converted to " #o "; maybe inherit from FormulaToken instead!")
 #else
 #define IF_NOT_OPCODE_ERROR(o,c)
 #endif
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 0f59686..a848a46 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -381,7 +381,7 @@ void ImportExcel8::ReadBasic()
                 ScCTBWrapper wrapper;
                 if ( wrapper.Read( *xXCB ) )
                 {
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DEBUG_SC_EXCEL
                     wrapper.Print( stderr );
 #endif
                     wrapper.ImportCustomToolBar( *pShell );
diff --git a/sc/source/filter/excel/xltoolbar.cxx b/sc/source/filter/excel/xltoolbar.cxx
index 607eb0c..8d7fc32 100644
--- a/sc/source/filter/excel/xltoolbar.cxx
+++ b/sc/source/filter/excel/xltoolbar.cxx
@@ -99,7 +99,7 @@ bool ScCTB::Read( SvStream &rS )
     return true;
 }
 
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DEBUG_SC_EXCEL
 void ScCTB::Print( FILE* fp )
 {
     Indent a;
@@ -196,7 +196,7 @@ bool CTBS::Read( SvStream &rS )
     return true;
 }
 
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DEBUG_SC_EXCEL
 void CTBS::Print( FILE* fp )
 {
     Indent a;
@@ -243,7 +243,7 @@ ScTBC::Read(SvStream &rS)
     return true;
 }
 
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DEBUG_SC_EXCEL
 void
 ScTBC::Print(FILE* fp)
 {
@@ -308,7 +308,7 @@ bool ScTBC::ImportToolBarControl( ScCTBWrapper& rWrapper, const css::uno::Refere
     return true;
 }
 
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DEBUG_SC_EXCEL
 void
 TBCCmd::Print(FILE* fp)
 {
@@ -372,7 +372,7 @@ ScCTBWrapper::Read( SvStream &rS)
     return true;
 }
 
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DEBUG_SC_EXCEL
 void
 ScCTBWrapper::Print( FILE* fp )
 {
diff --git a/sc/source/filter/excel/xltoolbar.hxx b/sc/source/filter/excel/xltoolbar.hxx
index 5f03ef0..1ee3d54 100644
--- a/sc/source/filter/excel/xltoolbar.hxx
+++ b/sc/source/filter/excel/xltoolbar.hxx
@@ -26,7 +26,7 @@ public:
     bool C:1;
     sal_uInt16 reserved3:8;
     bool Read( SvStream& rS ) override;
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DEBUG_SC_EXCEL
     virtual void Print(FILE* fp) override;
 #endif
 };
@@ -39,7 +39,7 @@ class ScTBC : public TBBase
 public:
     ScTBC();
     virtual ~ScTBC(){}
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DEBUG_SC_EXCEL
     virtual void Print( FILE* ) override;
 #endif
     bool Read(SvStream &rS) override;
@@ -56,7 +56,7 @@ class ScCTB : public TBBase
 public:
     explicit ScCTB(sal_uInt16);
     virtual ~ScCTB(){}
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DEBUG_SC_EXCEL
     virtual void Print( FILE* ) override;
 #endif
     bool Read(SvStream &rS) override;
@@ -82,7 +82,7 @@ public:
     CTBS& operator = ( const CTBS&);
     CTBS();
     virtual ~CTBS(){}
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DEBUG_SC_EXCEL
     virtual void Print( FILE* ) override;
 #endif
     bool Read(SvStream &rS) override;
@@ -98,7 +98,7 @@ public:
     ScCTBWrapper();
     virtual ~ScCTBWrapper();
     bool Read(SvStream &rS) override;
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DEBUG_SC_EXCEL
     virtual void Print( FILE* ) override;
 #endif
     void ImportCustomToolBar( SfxObjectShell& rDocSh );
diff --git a/sc/source/filter/qpro/biff.cxx b/sc/source/filter/qpro/biff.cxx
index a23f578..0e871a0 100644
--- a/sc/source/filter/qpro/biff.cxx
+++ b/sc/source/filter/qpro/biff.cxx
@@ -66,7 +66,7 @@ bool ScBiffReader::nextRecord()
     mpStream->ReadUInt16( mnId ).ReadUInt16( mnLength );
 
     mnOffset = mpStream->Tell();
-#if OSL_DEBUG_LEVEL > 1
+#ifdef DEBUG_SC_QPRO
     fprintf( stderr, "Read record 0x%x length 0x%x at offset 0x%x\n",
         (unsigned)mnId, (unsigned)mnLength, (unsigned)mnOffset );
 
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index b6ea827..2bc0389 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -894,9 +894,6 @@ void ScFormatRangeStyles::GetFormatRanges(const sal_Int32 nStartColumn, const sa
     sal_Int32 nColumns = 0;
     while (aItr != aEndItr && nColumns < nTotalColumns)
     {
-#if OSL_DEBUG_LEVEL > 1
-        table::CellRangeAddress aTempRangeAddress((*aItr).aRangeAddress);
-#endif
         if (((*aItr).aRangeAddress.StartRow <= nRow) &&
             ((*aItr).aRangeAddress.EndRow >= nRow))
         {
diff --git a/sc/source/filter/xml/xmlbodyi.cxx b/sc/source/filter/xml/xmlbodyi.cxx
index c04c287..88b4a34 100644
--- a/sc/source/filter/xml/xmlbodyi.cxx
+++ b/sc/source/filter/xml/xmlbodyi.cxx
@@ -76,10 +76,7 @@ ScXMLBodyContext::ScXMLBodyContext( ScXMLImport& rImport,
         formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_ODFF;
         OUString aVer( rImport.GetODFVersion());
         sal_Int32 nLen = aVer.getLength();
-#if OSL_DEBUG_LEVEL > 1
-        fprintf( stderr, "\n ScXMLBodyContext ODFVersion: nLen: %d, str: %s\n",
-                (int)nLen, OUStringToOString( aVer, RTL_TEXTENCODING_UTF8).getStr());
-#endif
+        SAL_INFO("sc.filter", "ScXMLBodyContext ODFVersion: nLen: " << nLen << " str : " << aVer);
         if (!nLen)
             eGrammar = formula::FormulaGrammar::GRAM_PODF;
         else
diff --git a/sc/source/ui/Accessibility/DrawModelBroadcaster.cxx b/sc/source/ui/Accessibility/DrawModelBroadcaster.cxx
index f87caa4..a38c08c 100644
--- a/sc/source/ui/Accessibility/DrawModelBroadcaster.cxx
+++ b/sc/source/ui/Accessibility/DrawModelBroadcaster.cxx
@@ -73,11 +73,7 @@ void ScDrawModelBroadcaster::Notify( SfxBroadcaster&,
         catch( const uno::RuntimeException& r )
         {
             (void) r;
-#if OSL_DEBUG_LEVEL > 1
-            OStringBuffer aError("Runtime exception caught while notifying shape.:\n");
-            aError.append(OUStringToOString(r.Message, RTL_TEXTENCODING_ASCII_US));
-            OSL_FAIL( aError.getStr() );
-#endif
+            SAL_WARN("sc.ui", "Runtime exception caught while notifying shape. : " << r.Message);
         }
     }
 }


More information about the Libreoffice-commits mailing list