summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-11-19 16:42:36 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-11-20 08:04:12 +0100
commit9dbfecaee0ab804b393e40e4399a0e4b87433b80 (patch)
treeaac388778d1488fc35290bed28a8ab3e89adebc2 /vcl
parentbfaa753ae459a6eab8a216b1541faa8a805f3f50 (diff)
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 <sbergman@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/svapp.cxx7
1 files changed, 4 insertions, 3 deletions
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 <osl/process.h>
#include <cassert>
+#include <limits>
#include <string_view>
#include <utility>
#include <thread>
@@ -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<tools::Long>::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;