[PATCH 2/9] remove warnings in binfilter - sc_interpr2.cxx

Pierre-André Jacquod pjacquod at alumni.ethz.ch
Tue Nov 23 12:06:58 PST 2010


based on the following compiler warnings:

sc_interpr2.cxx:1729:22: warning: comparison is always false due to limited range of data type

sc_interpr2.cxx:893:12: warning: unused variable 'fRestwert1'
sc_interpr2.cxx:895:10: warning: unused variable 'bFirstFlag'
sc_interpr2.cxx:896:10: warning: unused variable 'b2Flag'
sc_interpr2.cxx:897:12: warning: unused variable 'fAbschlag'
sc_interpr2.cxx:1423:54: warning: suggest parentheses around assignment used as truth value
sc_interpr2.cxx:1484:32: warning: suggest explicit braces to avoid ambiguous 'else'
sc_interpr2.cxx:863:12: warning: 'nGda2' may be used uninitialized in this function
sc_interpr2.cxx:1420:22: warning: 'bHasNote' may be used uninitialized in this function
---
 binfilter/bf_sc/source/core/tool/sc_interpr2.cxx |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/binfilter/bf_sc/source/core/tool/sc_interpr2.cxx b/binfilter/bf_sc/source/core/tool/sc_interpr2.cxx
index 52bdf1d..71b27da 100644
--- a/binfilter/bf_sc/source/core/tool/sc_interpr2.cxx
+++ b/binfilter/bf_sc/source/core/tool/sc_interpr2.cxx
@@ -860,10 +860,8 @@ void ScInterpreter::ScGDA2()
     double nAbRate = 1.0 - pow(nRest / nWert, 1.0 / nDauer);
     nAbRate = ::rtl::math::approxFloor((nAbRate * 1000.0) + 0.5) / 1000.0;
     double nErsteAbRate = nWert * nAbRate * nMonate / 12.0;
-    double nGda2;
-    if (::rtl::math::approxFloor(nPeriode) == 1)
-        nGda2 = nErsteAbRate;
-    else
+    double nGda2  = nErsteAbRate;
+    if (::rtl::math::approxFloor(nPeriode) != 1)
     {
         double nSummAbRate = nErsteAbRate;
         double nMin = nDauer;
@@ -890,11 +888,7 @@ double ScInterpreter::ScInterVDB(double fWert,double fRest,double fDauer,
 
     double fTerm, fLia;
     double fRestwert = fWert - fRest;
-    double fRestwert1 = fRestwert;
     BOOL bNowLia = FALSE;
-    BOOL bFirstFlag=TRUE;
-    BOOL b2Flag=TRUE;
-    double fAbschlag=0;
 
     double fGda;
     ULONG i;
@@ -1417,10 +1411,10 @@ void ScInterpreter::ScBackSolver()
                 ScRange aVRange( aVAdr, aVAdr );	// fuer SetDirty
                 double nSaveVal;
                 ScPostIt aNote;
-                BOOL bHasNote;
+                BOOL bHasNote = 0;
                 if ( bTempCell )
                 {
-                    if ( bHasNote = (pVCell != NULL) )
+                    if ( ( bHasNote = (pVCell != NULL) ) )
                         bHasNote = pVCell->GetNote( aNote );
                     nSaveVal = 0.0;
                     pVCell = new ScValueCell( nSaveVal );
@@ -1482,10 +1476,12 @@ void ScInterpreter::ScBackSolver()
                         {
                             fs = (fn1 - fn) / (xn1 - xn);
                             if (fabs(fs) < nEps)
+                            {
                                 if (fs < 0.0)
                                     fs = -nEps;
                                 else
                                     fs = nEps;
+                            }
                         }
                         else
                             fs = nEps;
@@ -1726,7 +1722,7 @@ ScDdeLink* lcl_GetDdeLink( SvxLinkManager* pLinkMgr,
 /*N*/  		String aTopic = GetString();
 /*N*/  		String aAppl  = GetString();
 /*N*/  
-/*N*/  		if (nMode < SC_DDE_DEFAULT || nMode > SC_DDE_TEXT)
+/*N*/  		if (nMode > SC_DDE_TEXT)
 /*N*/  			nMode = SC_DDE_DEFAULT;
 /*N*/  
 /*N*/  		//	temporary documents (ScFunctionAccess) have no DocShell
-- 
1.7.1


--------------000904060403020404090602--


More information about the LibreOffice mailing list