[Libreoffice-commits] core.git: vcl/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 23 10:13:02 UTC 2020


 vcl/source/window/splitwin.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 1f0ef4a86cf7ff83bba26f141408d9ccb296fb2a
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Jan 23 09:34:21 2020 +0100
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Jan 23 11:12:29 2020 +0100

    Avoid explicit casts to smaller sal_uInt16 from larger long resp. int
    
    ...in what might be attempts to avoid warnings about signed vs. unsigned
    comparisons
    
    Change-Id: I9d6b9f1fce6de829103c5c35d5d606ce0398807a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87241
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx
index 4ae7f4851fda..f1f56776cc5d 100644
--- a/vcl/source/window/splitwin.cxx
+++ b/vcl/source/window/splitwin.cxx
@@ -19,6 +19,7 @@
 
 #include <string.h>
 
+#include <o3tl/safeint.hxx>
 #include <sal/log.hxx>
 
 #include <vcl/event.hxx>
@@ -491,7 +492,7 @@ static void ImplCalcSet( ImplSplitSet* pSet,
                 }
             }
             // do not compensate rounding errors here
-            if ( (nAbsItems < static_cast<sal_uInt16>(std::abs( nSizeDelta ))) && nSizeWinSize )
+            if ( (nAbsItems < o3tl::make_unsigned(std::abs( nSizeDelta ))) && nSizeWinSize )
             {
                 long nNewSizeWinSize = 0;
 
@@ -1678,7 +1679,7 @@ void SplitWindow::ImplStartSplit( const MouseEvent& rMEvt )
     bool            bPropSmaller;
 
     mnMouseModifier = rMEvt.GetModifier();
-    bPropSmaller = (mnMouseModifier & KEY_SHIFT) && (static_cast<sal_uInt16>(mnSplitPos+1) < mpSplitSet->mvItems.size());
+    bPropSmaller = (mnMouseModifier & KEY_SHIFT) && (o3tl::make_unsigned(mnSplitPos+1) < mpSplitSet->mvItems.size());
 
     // here we can set the maximum size
     StartSplit();


More information about the Libreoffice-commits mailing list