svx/source/customshapes/EnhancedCustomShapeFontWork.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
New commits: commit 060d2fe39f27ffbb0e843de5031f6806c9abfce8 Author: Sakura286 <sakura...@outlook.com> AuthorDate: Thu Oct 24 16:21:52 2024 +0800 Commit: Hossein <hoss...@libreoffice.org> CommitDate: Mon Nov 4 17:32:51 2024 +0100 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 <hoss...@libreoffice.org> 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;