summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-05-24 15:26:06 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-05-24 16:50:03 +0200
commit5060c5015882b7109c54598c4ea858949beafc43 (patch)
treec8c153d73f6c6ebbe2dae768c1da72d28312efd4 /desktop
parenta86818c15a6b4773ddd012db37d55b5204163c24 (diff)
Use o3tl::make_unsigned in some places
...where a signed and an unsigned value are compared, and the signed value has just been proven to be non-negative here Change-Id: I20600d61a5d59d739bc1bee838c0038e4611aec2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134875 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/deployment/gui/dp_gui_extlistbox.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index 3b96147bbf02..a60fffd50bc2 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -35,6 +35,7 @@
#include <com/sun/star/system/SystemShellExecute.hpp>
#include <cppuhelper/weakref.hxx>
#include <i18nlangtag/languagetag.hxx>
+#include <o3tl/safeint.hxx>
#include <osl/diagnose.h>
#include <rtl/ustrbuf.hxx>
#include <vcl/event.hxx>
@@ -354,7 +355,7 @@ void ExtensionBox_Impl::selectEntry( const tools::Long nPos )
m_vEntries[ m_nActive ]->m_bActive = false;
}
- if ( ( nPos >= 0 ) && ( nPos < static_cast<tools::Long>(m_vEntries.size()) ) )
+ if ( ( nPos >= 0 ) && ( o3tl::make_unsigned(nPos) < m_vEntries.size() ) )
{
m_bHasActive = true;
m_nActive = nPos;
@@ -623,7 +624,7 @@ bool ExtensionBox_Impl::HandleCursorKey( sal_uInt16 nKeyCode )
if ( nSelect < 0 )
nSelect = 0;
- if ( nSelect >= static_cast<tools::Long>(m_vEntries.size()) )
+ if ( o3tl::make_unsigned(nSelect) >= m_vEntries.size() )
nSelect = m_vEntries.size() - 1;
selectEntry( nSelect );
@@ -732,7 +733,7 @@ bool ExtensionBox_Impl::MouseMove( const MouseEvent& rMEvt )
bool bOverHyperlink = false;
auto nPos = PointToPos( rMEvt.GetPosPixel() );
- if ( ( nPos >= 0 ) && ( nPos < static_cast<tools::Long>(m_vEntries.size()) ) )
+ if ( ( nPos >= 0 ) && ( o3tl::make_unsigned(nPos) < m_vEntries.size() ) )
{
const auto& rEntry = m_vEntries[nPos];
bOverHyperlink = !rEntry->m_sPublisher.isEmpty() && rEntry->m_aLinkRect.Contains(rMEvt.GetPosPixel());
@@ -749,7 +750,7 @@ bool ExtensionBox_Impl::MouseMove( const MouseEvent& rMEvt )
OUString ExtensionBox_Impl::RequestHelp(tools::Rectangle& rRect)
{
auto nPos = PointToPos( rRect.TopLeft() );
- if ( ( nPos >= 0 ) && ( nPos < static_cast<tools::Long>(m_vEntries.size()) ) )
+ if ( ( nPos >= 0 ) && ( o3tl::make_unsigned(nPos) < m_vEntries.size() ) )
{
const auto& rEntry = m_vEntries[nPos];
bool bOverHyperlink = !rEntry->m_sPublisher.isEmpty() && rEntry->m_aLinkRect.Contains(rRect);
@@ -774,7 +775,7 @@ bool ExtensionBox_Impl::MouseButtonDown( const MouseEvent& rMEvt )
{
auto nPos = PointToPos( rMEvt.GetPosPixel() );
- if ( ( nPos >= 0 ) && ( nPos < static_cast<tools::Long>(m_vEntries.size()) ) )
+ if ( ( nPos >= 0 ) && ( o3tl::make_unsigned(nPos) < m_vEntries.size() ) )
{
const auto& rEntry = m_vEntries[nPos];
if (!rEntry->m_sPublisher.isEmpty() && rEntry->m_aLinkRect.Contains(rMEvt.GetPosPixel()))