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 /extensions/source/propctrlr | |
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 'extensions/source/propctrlr')
-rw-r--r-- | extensions/source/propctrlr/formmetadata.cxx | 3 | ||||
-rw-r--r-- | extensions/source/propctrlr/genericpropertyhandler.cxx | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/extensions/source/propctrlr/formmetadata.cxx b/extensions/source/propctrlr/formmetadata.cxx index 54a9d7cf2e0f..13a7b32e706b 100644 --- a/extensions/source/propctrlr/formmetadata.cxx +++ b/extensions/source/propctrlr/formmetadata.cxx @@ -25,6 +25,7 @@ #include <strings.hrc> #include <stringarrays.hrc> #include <comphelper/extract.hxx> +#include <o3tl/safeint.hxx> #include <osl/diagnose.h> #include <sal/macros.h> #include <algorithm> @@ -675,7 +676,7 @@ namespace pcr --nIntValue; std::vector< OUString > aEnumStrings = m_rMetaData.getPropertyEnumRepresentations( m_nPropertyId ); - if ( ( nIntValue >= 0 ) && ( nIntValue < static_cast<sal_Int32>(aEnumStrings.size()) ) ) + if ( ( nIntValue >= 0 ) && ( o3tl::make_unsigned(nIntValue) < aEnumStrings.size() ) ) { sReturn = aEnumStrings[ nIntValue ]; } diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx index 6d26811cee1d..8320e5154d14 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ b/extensions/source/propctrlr/genericpropertyhandler.cxx @@ -39,6 +39,7 @@ #include <comphelper/propertyvalue.hxx> #include <comphelper/sequence.hxx> #include <comphelper/types.hxx> +#include <o3tl/safeint.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> @@ -166,7 +167,7 @@ namespace pcr sal_Int32 index = std::find( std::cbegin(aValues), std::cend(aValues), nAsInt ) - std::cbegin(aValues); std::vector< OUString > aDescriptions( getDescriptions() ); - if ( ( index >= 0 ) && ( index < static_cast<sal_Int32>(aDescriptions.size()) ) ) + if ( ( index >= 0 ) && ( o3tl::make_unsigned(index) < aDescriptions.size() ) ) sDescription = aDescriptions[ index ]; else { |