diff options
author | Sakura286 <sakura286@outlook.com> | 2024-10-24 16:21:52 +0800 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2024-11-04 17:32:51 +0100 |
commit | 060d2fe39f27ffbb0e843de5031f6806c9abfce8 (patch) | |
tree | 0d88697c1b481422f73d433f5219c342364aa893 /svx/source | |
parent | 182140d53ac767f5f31aefb2f00ac1f812245703 (diff) |
tdf#147906: Use hypot in place of sqrt to avoid overflow
Change-Id: I575bc0c1b6e49ad8dc5db6b3e523ca7e0860aad8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175537
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index ab33b589b5d2..03ddf6e7ed3e 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -839,7 +839,7 @@ static void FitTextOutlinesToShapeOutlines(const tools::PolyPolygon& aOutlines2d Point aPoint = rOutlinePoly.GetPoint(nPointIdx2) - rOutlinePoly.GetPoint(nPointIdx1); - double fLen = sqrt(aPoint.X() * aPoint.X() + aPoint.Y() * aPoint.Y()); + double fLen = hypot(aPoint.X(), aPoint.Y()); if (fLen > 0) { @@ -878,7 +878,7 @@ static void FitTextOutlinesToShapeOutlines(const tools::PolyPolygon& aOutlines2d //calculate distances between points on the outer outline const double fDx = vCurOutline[i].X() - vCurOutline[i - 1].X(); const double fDy = vCurOutline[i].Y() - vCurOutline[i - 1].Y(); - vCurDistances[i] = sqrt(fDx * fDx + fDy * fDy); + vCurDistances[i] = hypot(fDx, fDy); } else vCurDistances[i] = 0; |