From 9dbfecaee0ab804b393e40e4399a0e4b87433b80 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 19 Nov 2020 16:42:36 +0100 Subject: Use signed tools::Long return type for calcDistSquare ...for consistency with its internal workings of computing a value from other tools::Long values, even if the result can never be negative. (And where the additional bit for the unsigned type's magnitude probably doesn't make a difference here.) Change-Id: I1c6bcd2b8bdb70b9cd553758246af776b28500fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106178 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- vcl/source/app/svapp.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'vcl/source/app') diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 3ee9413edf7f..f91375e77edd 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -73,6 +73,7 @@ #include #include +#include #include #include #include @@ -1259,7 +1260,7 @@ tools::Rectangle Application::GetScreenPosSizePixel( unsigned int nScreen ) } namespace { -unsigned long calcDistSquare( const Point& i_rPoint, const tools::Rectangle& i_rRect ) +tools::Long calcDistSquare( const Point& i_rPoint, const tools::Rectangle& i_rRect ) { const Point aRectCenter( (i_rRect.Left() + i_rRect.Right())/2, (i_rRect.Top() + i_rRect.Bottom())/ 2 ); @@ -1301,11 +1302,11 @@ unsigned int Application::GetBestScreen( const tools::Rectangle& i_rRect ) // finally the screen which center is nearest to the rect is the best const Point aCenter( (i_rRect.Left() + i_rRect.Right())/2, (i_rRect.Top() + i_rRect.Bottom())/2 ); - unsigned long nDist = ULONG_MAX; + tools::Long nDist = std::numeric_limits::max(); for( unsigned int i = 0; i < nScreens; i++ ) { const tools::Rectangle aCurScreenRect( GetScreenPosSizePixel( i ) ); - const unsigned long nCurDist( calcDistSquare( aCenter, aCurScreenRect ) ); + const tools::Long nCurDist( calcDistSquare( aCenter, aCurScreenRect ) ); if( nCurDist < nDist ) { nBestMatchScreen = i; -- cgit