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

Noel Grandin noel at peralex.com
Wed Jan 27 22:44:13 PST 2016


 vcl/source/filter/sgvspln.cxx     |    7 ++++---
 vcl/source/gdi/pdfwriter_impl.cxx |    2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 556ce647aacc635ea05bd6d6e030d93d341b5624
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Jan 25 13:33:17 2016 +0200

    loplugin:fpcomparison in vcl/
    
    Change-Id: I29f8c2c0f19e2440565f5300deffc412faa5870e
    Reviewed-on: https://gerrit.libreoffice.org/21775
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/vcl/source/filter/sgvspln.cxx b/vcl/source/filter/sgvspln.cxx
index 84e65e3..40f168a 100644
--- a/vcl/source/filter/sgvspln.cxx
+++ b/vcl/source/filter/sgvspln.cxx
@@ -19,6 +19,7 @@
 
 #include <tools/poly.hxx>
 #include <memory>
+#include <rtl/math.hxx>
 
 #include <sgvspln.hxx>
 #include <cmath>
@@ -498,7 +499,7 @@ sal_uInt16 PeriodicSpline(sal_uInt16 n, double* x, double* y,
     if (n<2) return 4;
     nm1=n-1;
     for (i=0;i<=nm1;i++) if (x[i+1]<=x[i]) return 2; // should be strictly monotonically decreasing!
-    if (y[n]!=y[0]) return 3; // begin and end should be equal!
+    if (!rtl::math::approxEqual(y[n],y[0])) return 3; // begin and end should be equal!
 
     a.reset(new double[n+1]);
     lowrow.reset(new double[n+1]);
@@ -577,8 +578,8 @@ sal_uInt16 ParaSpline(sal_uInt16 n, double* x, double* y, sal_uInt8 MargCond,
             alphY=Marg02; betY=MargN2;
         } break;
         case 3: {
-            if (x[n]!=x[0]) return 3;
-            if (y[n]!=y[0]) return 4;
+            if (!rtl::math::approxEqual(x[n],x[0])) return 3;
+            if (!rtl::math::approxEqual(y[n],y[0])) return 4;
         } break;
         case 4: {
             if (std::abs(Marg01)>=MAXROOT) {
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 53e52f1..d785012 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -878,7 +878,7 @@ static void appendDouble( double fValue, OStringBuffer& rBuffer, sal_Int32 nPrec
     sal_Int64 nInt = (sal_Int64)fValue;
     fValue -= (double)nInt;
     // optimizing hardware may lead to a value of 1.0 after the subtraction
-    if( fValue == 1.0 || log10( 1.0-fValue ) <= -nPrecision )
+    if( rtl::math::approxEqual(fValue, 1.0) || log10( 1.0-fValue ) <= -nPrecision )
     {
         nInt++;
         fValue = 0.0;


More information about the Libreoffice-commits mailing list