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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Jun 20 14:27:47 UTC 2021


 tools/source/generic/poly.cxx |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 6a1dea1d7a1c7ede887c66e6fd2ddecedf5404b9
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Jun 20 14:22:35 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Jun 20 16:27:08 2021 +0200

    Revert "ofz#33769 Integer-overflow"
    
    now fixed at an earlier stage so NaN isn't imported from dxf
    
    This reverts commit 71fe0aeee20640c57816dc45010d32dac9afeaaf.
    
    Change-Id: Id2689e33f89deb08e1bcd39a6d4ba38fb4663681
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117511
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 857a1a8e7cbb..9d5f63fc65e9 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -57,7 +57,7 @@
 static double ImplGetParameter( const Point& rCenter, const Point& rPt, double fWR, double fHR )
 {
     const tools::Long nDX = rPt.X() - rCenter.X();
-    double fAngle = atan2( o3tl::saturating_toggle_sign(rPt.Y()) + rCenter.Y(), ( ( nDX == 0 ) ? 0.000000001 : nDX ) );
+    double fAngle = atan2( -rPt.Y() + rCenter.Y(), ( ( nDX == 0 ) ? 0.000000001 : nDX ) );
 
     return atan2(fWR*sin(fAngle), fHR*cos(fAngle));
 }
@@ -236,8 +236,8 @@ ImplPolygon::ImplPolygon( const tools::Rectangle& rBound, const Point& rStart, c
         // tdf#142268 Get Top Left corner of rectangle (the rectangle is not always correctly created)
         const auto aBoundLeft = rBound.Left() < aCenter.X() ? rBound.Left() : rBound.Right();
         const auto aBoundTop = rBound.Top() < aCenter.Y() ? rBound.Top() : rBound.Bottom();
-        const auto nRadX = o3tl::saturating_sub(aCenter.X(), aBoundLeft);
-        const auto nRadY = o3tl::saturating_sub(aCenter.Y(), aBoundTop);
+        const auto nRadX = aCenter.X() - aBoundLeft;
+        const auto nRadY = aCenter.Y() - aBoundTop;
         sal_uInt16  nPoints;
 
         tools::Long nRadXY;
@@ -255,7 +255,7 @@ ImplPolygon::ImplPolygon( const tools::Rectangle& rBound, const Point& rStart, c
         }
 
 
-        if (nRadX > 32 && nRadY > 32 && o3tl::saturating_add(nRadX, nRadY) < 8192)
+        if( ( nRadX > 32 ) && ( nRadY > 32 ) && ( nRadX + nRadY ) < 8192 )
             nPoints >>= 1;
 
         // compute threshold


More information about the Libreoffice-commits mailing list