summaryrefslogtreecommitdiff
path: root/svx
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 /svx
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 'svx')
-rw-r--r--svx/source/form/fmshimp.cxx4
-rw-r--r--svx/source/form/formcontroller.cxx2
-rw-r--r--svx/source/table/tablelayouter.hxx5
3 files changed, 6 insertions, 5 deletions
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index a16716ea143d..6e013df3b634 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -2161,7 +2161,7 @@ IMPL_LINK(FmXFormShell, OnFoundData_Lock, FmFoundRecordInformation&, rfriWhere,
if (impl_checkDisposed_Lock())
return;
- DBG_ASSERT((rfriWhere.nContext >= 0) && (rfriWhere.nContext < static_cast<sal_Int16>(m_aSearchForms.size())),
+ DBG_ASSERT((rfriWhere.nContext >= 0) && (o3tl::make_unsigned(rfriWhere.nContext) < m_aSearchForms.size()),
"FmXFormShell::OnFoundData : invalid context!");
Reference< XForm> xForm( m_aSearchForms.at(rfriWhere.nContext));
DBG_ASSERT(xForm.is(), "FmXFormShell::OnFoundData : invalid form!");
@@ -2244,7 +2244,7 @@ IMPL_LINK(FmXFormShell, OnCanceledNotFound_Lock, FmFoundRecordInformation&, rfri
if (impl_checkDisposed_Lock())
return;
- DBG_ASSERT((rfriWhere.nContext >= 0) && (rfriWhere.nContext < static_cast<sal_Int16>(m_aSearchForms.size())),
+ DBG_ASSERT((rfriWhere.nContext >= 0) && (o3tl::make_unsigned(rfriWhere.nContext) < m_aSearchForms.size()),
"FmXFormShell::OnCanceledNotFound : invalid context!");
Reference< XForm> xForm( m_aSearchForms.at(rfriWhere.nContext));
DBG_ASSERT(xForm.is(), "FmXFormShell::OnCanceledNotFound : invalid form!");
diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx
index c8c68180e605..d38b14d67367 100644
--- a/svx/source/form/formcontroller.cxx
+++ b/svx/source/form/formcontroller.cxx
@@ -1067,7 +1067,7 @@ Any SAL_CALL FormController::getByIndex(sal_Int32 Index)
{
::osl::MutexGuard aGuard( m_aMutex );
if (Index < 0 ||
- Index >= static_cast<sal_Int32>(m_aChildren.size()))
+ o3tl::make_unsigned(Index) >= m_aChildren.size())
throw IndexOutOfBoundsException();
return Any( m_aChildren[ Index ] );
diff --git a/svx/source/table/tablelayouter.hxx b/svx/source/table/tablelayouter.hxx
index e40b7a5862e0..309269bcce52 100644
--- a/svx/source/table/tablelayouter.hxx
+++ b/svx/source/table/tablelayouter.hxx
@@ -23,6 +23,7 @@
#include <sal/types.h>
#include <basegfx/range/b2irectangle.hxx>
#include <basegfx/tuple/b2ituple.hxx>
+#include <o3tl/safeint.hxx>
#include <vector>
#include <svx/svdotable.hxx>
@@ -129,8 +130,8 @@ private:
void LayoutTableWidth( ::tools::Rectangle& rArea, bool bFit );
void LayoutTableHeight( ::tools::Rectangle& rArea, bool bFit );
- bool isValidColumn( sal_Int32 nColumn ) const { return (nColumn >= 0) && (nColumn < static_cast<sal_Int32>( maColumns.size())); }
- bool isValidRow( sal_Int32 nRow ) const { return (nRow >= 0) && (nRow < static_cast<sal_Int32>( maRows.size())); }
+ bool isValidColumn( sal_Int32 nColumn ) const { return (nColumn >= 0) && (o3tl::make_unsigned(nColumn) < maColumns.size()); }
+ bool isValidRow( sal_Int32 nRow ) const { return (nRow >= 0) && (o3tl::make_unsigned(nRow) < maRows.size()); }
bool isValid( const CellPos& rPos ) const { return isValidColumn( rPos.mnCol ) && isValidRow( rPos.mnRow ); }
void ClearBorderLayout();