[Libreoffice-commits] .: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Dec 30 09:09:39 PST 2012


 sc/source/core/tool/chgtrack.cxx               |    4 -
 sc/source/core/tool/interpr3.cxx               |   59 +++++++++++++------------
 sc/source/filter/excel/excform.cxx             |    2 
 sc/source/filter/xml/xmlcelli.cxx              |    2 
 sc/source/ui/app/inputhdl.cxx                  |    8 +--
 sc/source/ui/condformat/condformatdlgentry.cxx |    6 --
 sc/source/ui/view/viewfun3.cxx                 |    2 
 7 files changed, 44 insertions(+), 39 deletions(-)

New commits:
commit dd4173e9bd4877721b2225975f9d01b1c88c1a9b
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sun Dec 30 17:35:24 2012 +0100

    Some cppcheck cleaning in sc
    
    Change-Id: I620a9329d50397a7ea498dc4703978026ad337ae

diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 85f61ce..ed05ee1 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -355,7 +355,6 @@ void ScChangeAction::RemoveAllDeletedIn()
 
 bool ScChangeAction::IsDeletedInDelType( ScChangeActionType eDelType ) const
 {
-    ScChangeAction* p;
     ScChangeActionLinkEntry* pL = GetDeletedIn();
     if ( pL )
     {
@@ -375,6 +374,7 @@ bool ScChangeAction::IsDeletedInDelType( ScChangeActionType eDelType ) const
             default:
                 eInsType = SC_CAT_NONE;
         }
+        ScChangeAction* p;
         while ( pL )
         {
             if ( (p = pL->GetAction()) != NULL &&
@@ -1033,10 +1033,10 @@ bool ScChangeActionDel::Reject( ScDocument* pDoc )
     if ( !aBigRange.IsValid( pDoc ) && GetType() != SC_CAT_DELETE_TABS )
         return false;
 
-    bool bOk = true;
 
     if ( IsTopDelete() )
     {   // den kompletten Bereich in einem Rutsch restaurieren
+        bool bOk = true;
         ScBigRange aTmpRange( GetOverAllRange() );
         if ( !aTmpRange.IsValid( pDoc ) )
         {
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 76f9a98..1b0e85a 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -212,41 +212,49 @@ double ScInterpreter::taylor(double* pPolynom, sal_uInt16 nMax, double x)
 double ScInterpreter::gauss(double x)
 {
     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::gauss" );
-    double t0[] =
-    { 0.39894228040143268, -0.06649038006690545,  0.00997355701003582,
-     -0.00118732821548045,  0.00011543468761616, -0.00000944465625950,
-      0.00000066596935163, -0.00000004122667415,  0.00000000227352982,
-      0.00000000011301172,  0.00000000000511243, -0.00000000000021218 };
-    double t2[] =
-    { 0.47724986805182079,  0.05399096651318805, -0.05399096651318805,
-      0.02699548325659403, -0.00449924720943234, -0.00224962360471617,
-      0.00134977416282970, -0.00011783742691370, -0.00011515930357476,
-      0.00003704737285544,  0.00000282690796889, -0.00000354513195524,
-      0.00000037669563126,  0.00000019202407921, -0.00000005226908590,
-     -0.00000000491799345,  0.00000000366377919, -0.00000000015981997,
-     -0.00000000017381238,  0.00000000002624031,  0.00000000000560919,
-     -0.00000000000172127, -0.00000000000008634,  0.00000000000007894 };
-    double t4[] =
-    { 0.49996832875816688,  0.00013383022576489, -0.00026766045152977,
-      0.00033457556441221, -0.00028996548915725,  0.00018178605666397,
-     -0.00008252863922168,  0.00002551802519049, -0.00000391665839292,
-     -0.00000074018205222,  0.00000064422023359, -0.00000017370155340,
-      0.00000000909595465,  0.00000000944943118, -0.00000000329957075,
-      0.00000000029492075,  0.00000000011874477, -0.00000000004420396,
-      0.00000000000361422,  0.00000000000143638, -0.00000000000045848 };
-    double asympt[] = { -1.0, 1.0, -3.0, 15.0, -105.0 };
 
     double xAbs = fabs(x);
     sal_uInt16 xShort = (sal_uInt16)::rtl::math::approxFloor(xAbs);
     double nVal = 0.0;
     if (xShort == 0)
+    {
+        double t0[] =
+        { 0.39894228040143268, -0.06649038006690545,  0.00997355701003582,
+         -0.00118732821548045,  0.00011543468761616, -0.00000944465625950,
+          0.00000066596935163, -0.00000004122667415,  0.00000000227352982,
+          0.00000000011301172,  0.00000000000511243, -0.00000000000021218 };
         nVal = taylor(t0, 11, (xAbs * xAbs)) * xAbs;
+    }
     else if ((xShort >= 1) && (xShort <= 2))
+    {
+        double t2[] =
+        { 0.47724986805182079,  0.05399096651318805, -0.05399096651318805,
+          0.02699548325659403, -0.00449924720943234, -0.00224962360471617,
+          0.00134977416282970, -0.00011783742691370, -0.00011515930357476,
+          0.00003704737285544,  0.00000282690796889, -0.00000354513195524,
+          0.00000037669563126,  0.00000019202407921, -0.00000005226908590,
+         -0.00000000491799345,  0.00000000366377919, -0.00000000015981997,
+         -0.00000000017381238,  0.00000000002624031,  0.00000000000560919,
+         -0.00000000000172127, -0.00000000000008634,  0.00000000000007894 };
         nVal = taylor(t2, 23, (xAbs - 2.0));
+    }
     else if ((xShort >= 3) && (xShort <= 4))
+    {
+       double t4[] =
+       { 0.49996832875816688,  0.00013383022576489, -0.00026766045152977,
+         0.00033457556441221, -0.00028996548915725,  0.00018178605666397,
+        -0.00008252863922168,  0.00002551802519049, -0.00000391665839292,
+        -0.00000074018205222,  0.00000064422023359, -0.00000017370155340,
+         0.00000000909595465,  0.00000000944943118, -0.00000000329957075,
+         0.00000000029492075,  0.00000000011874477, -0.00000000004420396,
+         0.00000000000361422,  0.00000000000143638, -0.00000000000045848 };
         nVal = taylor(t4, 20, (xAbs - 4.0));
+    }
     else
+    {
+        double asympt[] = { -1.0, 1.0, -3.0, 15.0, -105.0 };
         nVal = 0.5 + phi(xAbs) * taylor(asympt, 4, 1.0 / (xAbs * xAbs)) / xAbs;
+    }
     if (x < 0.0)
         return -nVal;
     else
@@ -1284,7 +1292,6 @@ void ScInterpreter::ScBinomDist()
         double n      = ::rtl::math::approxFloor(GetDouble());
         double x      = ::rtl::math::approxFloor(GetDouble());
         double q = (0.5 - p) + 0.5;           // get one bit more for p near 1.0
-        double fFactor, fSum;
         if (n < 0.0 || x < 0.0 || x > n || p < 0.0 || p > 1.0)
         {
             PushIllegalArgument();
@@ -1308,7 +1315,7 @@ void ScInterpreter::ScBinomDist()
                 PushDouble(1.0);
             else
             {
-                fFactor = pow(q, n);
+                double fFactor = pow(q, n);
                 if (x == 0.0)
                     PushDouble(fFactor);
                 else if (fFactor <= ::std::numeric_limits<double>::min())
@@ -1320,7 +1327,7 @@ void ScInterpreter::ScBinomDist()
                     {
                         if (fFactor > fMachEps)
                         {
-                            fSum = 1.0 - fFactor;
+                            double fSum = 1.0 - fFactor;
                             sal_uInt32 max = static_cast<sal_uInt32> (n - x) - 1;
                             for (sal_uInt32 i = 0; i < max && fFactor > 0.0; i++)
                             {
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index b66b507..b819ab0 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -128,10 +128,10 @@ void ImportExcel::Formula(
         else
         {
             CellType        eCellType;
-            ScBaseCell*     pBaseCell;
             pD->GetCellType( aScPos.Col(), aScPos.Row(), aScPos.Tab(), eCellType );
             if( eCellType == CELLTYPE_FORMULA )
             {
+                ScBaseCell* pBaseCell;
                 pD->GetCell( aScPos.Col(), aScPos.Row(), aScPos.Tab(), pBaseCell );
                 pCell = ( ScFormulaCell* ) pBaseCell;
                 if( pCell )
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index e27267d..957cb67 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1005,10 +1005,10 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos )
     ::boost::scoped_ptr<ScExternalRefManager::ApiGuard> pExtRefGuard;
     pExtRefGuard.reset(new ScExternalRefManager::ApiGuard(pDoc));
 
-    ScBaseCell* pNewCell = NULL;
 
     if ( !aText.isEmpty() )
     {
+        ScBaseCell* pNewCell = NULL;
         if ( aText[0] == '=' && aText.getLength() > 1 )
         {
             // temporary formula string as string tokens
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 6938e0d..39ad15d 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -849,12 +849,12 @@ void ScInputHandler::ShowTipCursor()
                             nArgPos = aHelper.GetArgStart( aSelText, nNextFStart, 0 );
                             nArgs = static_cast<sal_uInt16>(ppFDesc->getParameterCount());
 
-                            bool bFlag = false;
                             rtl::OUString aNew;
                             ScTypedCaseStrSet::const_iterator it =
                                 findText(*pFormulaDataPara, pFormulaDataPara->end(), ppFDesc->getFunctionName(), aNew, false);
                             if (it != pFormulaDataPara->end())
                             {
+                                bool bFlag = false;
                                 sal_uInt16 nActive = 0;
                                 for( sal_uInt16 i=0; i < nArgs; i++ )
                                 {
@@ -1100,12 +1100,12 @@ void ScInputHandler::UseFormulaData()
                         nArgPos = aHelper.GetArgStart( aFormula, nNextFStart, 0 );
                         nArgs = static_cast<sal_uInt16>(ppFDesc->getParameterCount());
 
-                        bool bFlag = false;
                         rtl::OUString aNew;
                         ScTypedCaseStrSet::const_iterator it =
                             findText(*pFormulaDataPara, pFormulaDataPara->end(), ppFDesc->getFunctionName(), aNew, false);
                         if (it != pFormulaDataPara->end())
                         {
+                            bool bFlag = false;
                             sal_uInt16 nActive = 0;
                             for( sal_uInt16 i=0; i < nArgs; i++ )
                             {
@@ -2493,7 +2493,6 @@ void ScInputHandler::EnterHandler( sal_uInt8 nBlockMode )
     SfxApplication* pSfxApp     = SFX_APP();
     EditTextObject* pObject     = NULL;
     ScPatternAttr*  pCellAttrs  = NULL;
-    bool            bAttrib     = false;    // Formatierung vorhanden ?
     bool            bForget     = false;    // wegen Gueltigkeit streichen ?
 
     rtl::OUString aString = GetEditText(pEngine);
@@ -2648,6 +2647,7 @@ void ScInputHandler::EnterHandler( sal_uInt8 nBlockMode )
 
         RemoveAdjust();
 
+        bool bAttrib = false;    // Formatierung vorhanden ?
         //  check if EditObject is needed
 
         if ( bSpellErrors || nParCnt > 1 )
@@ -3478,13 +3478,13 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState,
 
         if ( pState )
         {
-            bool bIgnore = false;
 
             //  hier auch fremde Referenzeingabe beruecksichtigen (z.B. Funktions-AP),
             //  FormEditData falls gerade von der Hilfe auf Calc umgeschaltet wird:
 
             if ( !bFormulaMode && !pScMod->IsFormulaMode() && !pScMod->GetFormEditData() )
             {
+                bool bIgnore = false;
                 if ( bModified )
                 {
                     if (pState->GetPos() != aCursorPos)
diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx
index b516670..15f6f42 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -693,14 +693,13 @@ void ScColorScale2FrmtEntry::Init()
     maLbEntryTypeMax.SetSelectHdl( LINK( this, ScColorScale2FrmtEntry, EntryTypeHdl ) );
 
     SfxObjectShell*     pDocSh      = SfxObjectShell::Current();
-    const SfxPoolItem*  pItem       = NULL;
     XColorListRef       pColorTable;
 
     DBG_ASSERT( pDocSh, "DocShell not found!" );
 
     if ( pDocSh )
     {
-        pItem = pDocSh->GetItem( SID_COLOR_TABLE );
+        const SfxPoolItem*  pItem = pDocSh->GetItem( SID_COLOR_TABLE );
         if ( pItem != NULL )
             pColorTable = ( (SvxColorListItem*)pItem )->GetColorList();
     }
@@ -852,14 +851,13 @@ void ScColorScale3FrmtEntry::Init()
     maLbEntryTypeMiddle.SetSelectHdl( LINK( this, ScColorScale3FrmtEntry, EntryTypeHdl ) );
 
     SfxObjectShell*     pDocSh      = SfxObjectShell::Current();
-    const SfxPoolItem*  pItem       = NULL;
     XColorListRef       pColorTable;
 
     DBG_ASSERT( pDocSh, "DocShell not found!" );
 
     if ( pDocSh )
     {
-        pItem = pDocSh->GetItem( SID_COLOR_TABLE );
+        const SfxPoolItem* pItem = pDocSh->GetItem( SID_COLOR_TABLE );
         if ( pItem != NULL )
             pColorTable = ( (SvxColorListItem*)pItem )->GetColorList();
     }
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index e4417ab..b2a6510 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -1194,7 +1194,6 @@ bool ScViewFunc::PasteFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc,
 
     ScDocument* pUndoDoc    = NULL;
     ScDocument* pRefUndoDoc = NULL;
-    ScDocument* pRedoDoc    = NULL;
     ScRefUndoData* pUndoData = NULL;
 
     if ( bRecord )
@@ -1331,6 +1330,7 @@ bool ScViewFunc::PasteFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc,
 
     if ( bRecord )
     {
+        ScDocument* pRedoDoc    = NULL;
         // Redo-Daten werden erst beim ersten Undo kopiert
         // ohne RefUndoDoc muss das Redo-Doc noch nicht angelegt werden
 


More information about the Libreoffice-commits mailing list