tools/source/generic/line.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
New commits: commit f59911c4381ca066facd0dcc6b1037077f4fc90a Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Oct 7 09:20:01 2022 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Oct 7 15:49:16 2022 +0200 ofz#52191 Integer-overflow Change-Id: I97daf9327c55229fe7da546164d398353e0696a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141046 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/tools/source/generic/line.cxx b/tools/source/generic/line.cxx index 1112da9863c2..ee9ad979793c 100644 --- a/tools/source/generic/line.cxx +++ b/tools/source/generic/line.cxx @@ -104,13 +104,13 @@ double Line::GetDistance( const double& rPtX, const double& rPtY ) const if( maStart != maEnd ) { - const double fDistX = maEnd.X() - maStart.X(); - const double fDistY = maEnd.Y() - maStart.Y(); - const double fACX = maStart.X() - rPtX; - const double fACY = maStart.Y() - rPtY; - const double fL2 = fDistX * fDistX + fDistY * fDistY; - const double fR = ( fACY * -fDistY - fACX * fDistX ) / fL2; - const double fS = ( fACY * fDistX - fACX * fDistY ) / fL2; + const double fDistX = static_cast<double>(maEnd.X()) - maStart.X(); + const double fDistY = static_cast<double>(maEnd.Y()) - maStart.Y(); + const double fACX = static_cast<double>(maStart.X()) - rPtX; + const double fACY = static_cast<double>(maStart.Y()) - rPtY; + const double fL2 = fDistX * fDistX + fDistY * fDistY; + const double fR = ( fACY * -fDistY - fACX * fDistX ) / fL2; + const double fS = ( fACY * fDistX - fACX * fDistY ) / fL2; if( fR < 0.0 ) {