[Libreoffice-commits] core.git: vcl/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Fri Nov 20 07:04:57 UTC 2020
vcl/source/app/svapp.cxx | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
New commits:
commit 9dbfecaee0ab804b393e40e4399a0e4b87433b80
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Nov 19 16:42:36 2020 +0100
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Nov 20 08:04:12 2020 +0100
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 at redhat.com>
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;
More information about the Libreoffice-commits
mailing list