diff options
Diffstat (limited to 'desktop/source/deployment/gui/dp_gui_extlistbox.cxx')
-rw-r--r-- | desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 11 |
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())) |