diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-05-24 15:26:06 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-05-24 16:50:03 +0200 |
commit | 5060c5015882b7109c54598c4ea858949beafc43 (patch) | |
tree | c8c153d73f6c6ebbe2dae768c1da72d28312efd4 /sfx2 | |
parent | a86818c15a6b4773ddd012db37d55b5204163c24 (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 'sfx2')
-rw-r--r-- | sfx2/source/dialog/filtergrouping.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/sidebar/FocusManager.cxx | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx index 59388eece485..ef1a4fef3035 100644 --- a/sfx2/source/dialog/filtergrouping.cxx +++ b/sfx2/source/dialog/filtergrouping.cxx @@ -18,6 +18,7 @@ */ #include "filtergrouping.hxx" +#include <o3tl/safeint.hxx> #include <sfx2/fcontnr.hxx> #include <sfx2/filedlghelper.hxx> #include <sfx2/strings.hrc> @@ -882,7 +883,7 @@ namespace sfx2 std::shared_ptr<const SfxFilter> TSortedFilterList::impl_getFilter(sal_Int32 nIndex) { - if (nIndex<0 || nIndex>=static_cast<sal_Int32>(m_lFilters.size())) + if (nIndex<0 || o3tl::make_unsigned(nIndex)>=m_lFilters.size()) return nullptr; const OUString& sFilterName = m_lFilters[nIndex]; if (sFilterName.isEmpty()) diff --git a/sfx2/source/sidebar/FocusManager.cxx b/sfx2/source/sidebar/FocusManager.cxx index 42a75af4fa4e..0b8755810c42 100644 --- a/sfx2/source/sidebar/FocusManager.cxx +++ b/sfx2/source/sidebar/FocusManager.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <o3tl/safeint.hxx> #include <sfx2/sidebar/FocusManager.hxx> #include <sfx2/sidebar/Deck.hxx> #include <sfx2/sidebar/Panel.hxx> @@ -193,7 +194,7 @@ bool FocusManager::IsDeckTitleVisible() const bool FocusManager::IsPanelTitleVisible (const sal_Int32 nPanelIndex) const { - if (nPanelIndex<0 || nPanelIndex>=static_cast<sal_Int32>(maPanels.size())) + if (nPanelIndex<0 || o3tl::make_unsigned(nPanelIndex)>=maPanels.size()) return false; TitleBar* pTitleBar = maPanels[nPanelIndex]->GetTitleBar(); @@ -206,7 +207,7 @@ void FocusManager::FocusPanel ( const sal_Int32 nPanelIndex, const bool bFallbackToDeckTitle) { - if (nPanelIndex<0 || nPanelIndex>=static_cast<sal_Int32>(maPanels.size())) + if (nPanelIndex<0 || o3tl::make_unsigned(nPanelIndex)>=maPanels.size()) { if (bFallbackToDeckTitle) FocusDeckTitle(); |