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

Noel Grandin noel at peralex.com
Wed Jan 27 22:45:14 PST 2016


 svx/source/customshapes/EnhancedCustomShapeFontWork.cxx |    2 +-
 svx/source/dialog/framelink.cxx                         |   16 ++++++++--------
 svx/source/toolbars/extrusionbar.cxx                    |    8 ++++----
 3 files changed, 13 insertions(+), 13 deletions(-)

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

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

diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index 55d95ee..0e33369 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -616,7 +616,7 @@ void GetPoint( const tools::Polygon& rPoly, const std::vector< double >& rDistan
         const Point& rPt = rPoly[ nIdx ];
         fx1 = rPt.X();
         fy1 = rPt.Y();
-        if ( nIdx && ( aIter != rDistances.end() ) && ( *aIter != fX ) )
+        if ( nIdx && ( aIter != rDistances.end() ) && !rtl::math::approxEqual( *aIter, fX ) )
         {
             nIdx = sal::static_int_cast<sal_uInt16>( std::distance( rDistances.begin(), aIter ) );
             double fDist0 = *( aIter - 1 );
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index 43bb94a..3938701 100644
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -371,7 +371,7 @@ void lclLinkLeftEnd_Single(
         // both vertical frame borders are double
         if( rLFromT.Secn() && rLFromB.Secn() )
         {
-            rResult.mnOffs1 = (!rLFromTR.Secn() && !rLFromBR.Secn() && (rLFromT.GetWidth() == rLFromB.GetWidth())) ?
+            rResult.mnOffs1 = (!rLFromTR.Secn() && !rLFromBR.Secn() && rtl::math::approxEqual(rLFromT.GetWidth(), rLFromB.GetWidth())) ?
                 // don't overdraw vertical borders with equal width
                 lclGetBehindEnd( rLFromT ) :
                 // take leftmost start of both secondary lines (#46488#)
@@ -379,14 +379,14 @@ void lclLinkLeftEnd_Single(
         }
 
         // single border with equal width coming from left
-        else if( !rLFromL.Secn() && (rLFromL.Prim() == rBorder.Prim()) )
+        else if( !rLFromL.Secn() && rtl::math::approxEqual(rLFromL.Prim(), rBorder.Prim()) )
             // draw to connection point
             rResult.mnOffs1 = 0;
 
         // single border coming from left
         else if( !rLFromL.Secn() && rLFromL.Prim() )
         {
-            if( rLFromL.Prim() == rBorder.Prim() )
+            if( rtl::math::approxEqual(rLFromL.Prim(), rBorder.Prim()) )
                 // draw to reference position, if from left has equal width
                 rResult.mnOffs1 = 0;
             else
@@ -400,7 +400,7 @@ void lclLinkLeftEnd_Single(
         // no border coming from left
         else if( !rLFromL.Prim() )
             // don't overdraw vertical borders with equal width
-            rResult.mnOffs1 = (rLFromT.GetWidth() == rLFromB.GetWidth()) ?
+            rResult.mnOffs1 = rtl::math::approxEqual(rLFromT.GetWidth(), rLFromB.GetWidth()) ?
                 lclGetBehindEnd( rLFromT ) :
                 std::min( lclGetBeg( rLFromT ), lclGetBeg( rLFromB ) );
 
@@ -457,7 +457,7 @@ void lclLinkLeftEnd_Prim(
         // double frame border coming from left (from top is not double)
         else if( rLFromL.Secn() )
             // do not overdraw single frame border coming from top
-            rResult.mnOffs1 = (rLFromL.GetWidth() == rBorder.GetWidth()) ?
+            rResult.mnOffs1 = rtl::math::approxEqual(rLFromL.GetWidth(), rBorder.GetWidth()) ?
                 0 : lclGetBehindEnd( rLFromT );
 
         // double frame border coming from bottom (from top and from left are not double)
@@ -500,7 +500,7 @@ void lclLinkLeftEnd_Gap(
     if ( rLFromT.Secn() )
         rResult.mnOffs1 = lclGetDistBeg( rLFromT );
     else if ( rLFromL.Secn( ) )
-        rResult.mnOffs1 = ( rLFromL.GetWidth() == rBorder.GetWidth() )?
+        rResult.mnOffs1 = rtl::math::approxEqual( rLFromL.GetWidth(), rBorder.GetWidth() ) ?
             0 : lclGetBehindEnd( rLFromT );
     else if ( rLFromB.Secn( ) )
         rResult.mnOffs1 = lclGetDistBeg( rLFromB );
@@ -1284,13 +1284,13 @@ bool operator<( const Style& rL, const Style& rR )
     // different total widths -> rL<rR, if rL is thinner
     double nLW = rL.GetWidth();
     double nRW = rR.GetWidth();
-    if( nLW != nRW ) return nLW < nRW;
+    if( !rtl::math::approxEqual(nLW, nRW) ) return nLW < nRW;
 
     // one line double, the other single -> rL<rR, if rL is single
     if( (rL.Secn() == 0) != (rR.Secn() == 0) ) return rL.Secn() == 0;
 
     // both lines double with different distances -> rL<rR, if distance of rL greater
-    if( (rL.Secn() && rR.Secn()) && (rL.Dist() != rR.Dist()) ) return rL.Dist() > rR.Dist();
+    if( (rL.Secn() && rR.Secn()) && !rtl::math::approxEqual(rL.Dist(), rR.Dist()) ) return rL.Dist() > rR.Dist();
 
     // both lines single and 1 unit thick, only one is dotted -> rL<rR, if rL is dotted
     if( (nLW == 1) && (rL.Type() != rR.Type()) ) return rL.Type();
diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx
index b364f05..de176d9 100644
--- a/svx/source/toolbars/extrusionbar.cxx
+++ b/svx/source/toolbars/extrusionbar.cxx
@@ -748,16 +748,16 @@ void getExtrusionDirectionState( SdrView* pSdrView, SfxItemSet& rSet )
                 }
             }
 
-            if( fFinalSkewAngle == -1.0 )
+            if( rtl::math::approxEqual(fFinalSkewAngle, -1.0) )
             {
                 fFinalSkewAngle = fSkewAngle;
             }
-            else if( fSkewAngle != fFinalSkewAngle )
+            else if( !rtl::math::approxEqual(fSkewAngle, fFinalSkewAngle) )
             {
                 fFinalSkewAngle = -1.0;
             }
 
-            if( fFinalSkewAngle == -1.0 )
+            if( rtl::math::approxEqual(fFinalSkewAngle, -1.0) )
                 break;
         }
     }
@@ -956,7 +956,7 @@ void getExtrusionDepthState( SdrView* pSdrView, SfxItemSet& rSet )
             {
                 fFinalDepth = fDepth;
             }
-            else if( fFinalDepth != fDepth )
+            else if( !rtl::math::approxEqual(fFinalDepth, fDepth) )
             {
                 fFinalDepth = -1;
                 break;


More information about the Libreoffice-commits mailing list