[Libreoffice-commits] .: scaddins/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Oct 6 12:48:51 PDT 2012


 scaddins/source/analysis/financial.cxx |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 89718e94ec0e61147c0a6a8aa168725df32a6d6c
Author: jailletc36 <christophe.jaillet at wanadoo.fr>
Date:   Sat Oct 6 21:39:06 2012 +0200

    cppcheck : redundantCondition. In this case, it seems to be a typo.
    
    Changed the redundant check against fRate with a test against fPrice as
    everywhere else in the file.
    Also change some comparisons against 0.0 instead of 0 when using floating
    point variable (to be consistent with the rest of the code).
    
    Change-Id: I94a397f1578a90156359987996cb1ef02d5e4209
    Reviewed-on: https://gerrit.libreoffice.org/779
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/scaddins/source/analysis/financial.cxx b/scaddins/source/analysis/financial.cxx
index 18e0f04..14415dd 100644
--- a/scaddins/source/analysis/financial.cxx
+++ b/scaddins/source/analysis/financial.cxx
@@ -199,7 +199,7 @@ double SAL_CALL AnalysisAddIn::getPrice( constREFXPS& xOpt,
     sal_Int32 nSettle, sal_Int32 nMat, double fRate, double fYield, double fRedemp, sal_Int32 nFreq,
     const ANY& rOB ) THROWDEF_RTE_IAE
 {
-    if( fYield < 0.0 || fRate < 0.0 || fRedemp <= 0 || CHK_Freq || nSettle >= nMat )
+    if( fYield < 0.0 || fRate < 0.0 || fRedemp <= 0.0 || CHK_Freq || nSettle >= nMat )
         THROW_IAE;
 
     double fRet = getPrice_( GetNullDate( xOpt ), nSettle, nMat, fRate, fYield, fRedemp, nFreq, getDateMode( xOpt, rOB ) );
@@ -210,7 +210,7 @@ double SAL_CALL AnalysisAddIn::getPrice( constREFXPS& xOpt,
 double SAL_CALL AnalysisAddIn::getPricedisc( constREFXPS& xOpt,
     sal_Int32 nSettle, sal_Int32 nMat, double fDisc, double fRedemp, const ANY& rOB ) THROWDEF_RTE_IAE
 {
-    if( fDisc <= 0.0 || fRedemp <= 0 || nSettle >= nMat )
+    if( fDisc <= 0.0 || fRedemp <= 0.0 || nSettle >= nMat )
         THROW_IAE;
 
     double fRet = fRedemp * ( 1.0 - fDisc * GetYearDiff( GetNullDate( xOpt ), nSettle, nMat, getDateMode( xOpt, rOB ) ) );
@@ -336,7 +336,7 @@ double SAL_CALL AnalysisAddIn::getYieldmat( constREFXPS& xOpt,
     sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue, double fRate, double fPrice, const ANY& rOB )
     THROWDEF_RTE_IAE
 {
-    if( fRate < 0.0 || fRate <= 0.0 || nSettle >= nMat )
+    if( fPrice <= 0.0 || fRate <= 0.0 || nSettle >= nMat )
         THROW_IAE;
 
     double fRet = GetYieldmat( GetNullDate( xOpt ),  nSettle, nMat, nIssue, fRate, fPrice, getDateMode( xOpt, rOB ) );
@@ -401,7 +401,7 @@ double SAL_CALL AnalysisAddIn::getOddfprice( constREFXPS& xOpt,
     sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue, sal_Int32 nFirstCoup,
     double fRate, double fYield, double fRedemp, sal_Int32 nFreq, const ANY& rOB ) THROWDEF_RTE_IAE
 {
-    if( fRate < 0 || fYield < 0 || CHK_Freq || nMat <= nFirstCoup || nFirstCoup <= nSettle || nSettle <= nIssue )
+    if( fRate < 0.0 || fYield < 0.0 || CHK_Freq || nMat <= nFirstCoup || nFirstCoup <= nSettle || nSettle <= nIssue )
         THROW_IAE;
 
     double fRet = GetOddfprice( GetNullDate( xOpt ), nSettle, nMat, nIssue, nFirstCoup, fRate, fYield, fRedemp, nFreq, getDateMode( xOpt, rOB ) );
@@ -413,7 +413,7 @@ double SAL_CALL AnalysisAddIn::getOddfyield( constREFXPS& xOpt,
     sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue, sal_Int32 nFirstCoup,
     double fRate, double fPrice, double fRedemp, sal_Int32 nFreq, const ANY& rOB ) THROWDEF_RTE_IAE
 {
-    if( fRate < 0 || fPrice <= 0 || CHK_Freq || nMat <= nFirstCoup || nFirstCoup <= nSettle || nSettle <= nIssue )
+    if( fRate < 0.0 || fPrice <= 0.0 || CHK_Freq || nMat <= nFirstCoup || nFirstCoup <= nSettle || nSettle <= nIssue )
         THROW_IAE;
 
     double fRet = GetOddfyield( GetNullDate( xOpt ), nSettle, nMat, nIssue, nFirstCoup, fRate, fPrice, fRedemp, nFreq,
@@ -426,7 +426,7 @@ double SAL_CALL AnalysisAddIn::getOddlprice( constREFXPS& xOpt,
     sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastInterest,
     double fRate, double fYield, double fRedemp, sal_Int32 nFreq, const ANY& rOB ) THROWDEF_RTE_IAE
 {
-    if( fRate < 0 || fYield < 0 || CHK_Freq || nMat <= nSettle || nSettle <= nLastInterest )
+    if( fRate < 0.0 || fYield < 0.0 || CHK_Freq || nMat <= nSettle || nSettle <= nLastInterest )
         THROW_IAE;
 
     double fRet = GetOddlprice( GetNullDate( xOpt ), nSettle, nMat, nLastInterest, fRate, fYield, fRedemp, nFreq,
@@ -439,7 +439,7 @@ double SAL_CALL AnalysisAddIn::getOddlyield( constREFXPS& xOpt,
     sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nLastInterest,
     double fRate, double fPrice, double fRedemp, sal_Int32 nFreq, const ANY& rOB ) THROWDEF_RTE_IAE
 {
-    if( fRate < 0 || fPrice <= 0 || CHK_Freq || nMat <= nSettle || nSettle <= nLastInterest )
+    if( fRate < 0.0 || fPrice <= 0.0 || CHK_Freq || nMat <= nSettle || nSettle <= nLastInterest )
         THROW_IAE;
 
     double fRet = GetOddlyield( GetNullDate( xOpt ), nSettle, nMat, nLastInterest, fRate, fPrice, fRedemp, nFreq,


More information about the Libreoffice-commits mailing list