summaryrefslogtreecommitdiff
path: root/i18nutil
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 /i18nutil
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 'i18nutil')
-rw-r--r--i18nutil/source/utility/scripttypedetector.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/i18nutil/source/utility/scripttypedetector.cxx b/i18nutil/source/utility/scripttypedetector.cxx
index bea0714f375b..f096ecbde831 100644
--- a/i18nutil/source/utility/scripttypedetector.cxx
+++ b/i18nutil/source/utility/scripttypedetector.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/i18n/UnicodeScript.hpp>
#include <i18nutil/scripttypedetector.hxx>
#include <i18nutil/unicode.hxx>
+#include <o3tl/safeint.hxx>
using namespace com::sun::star::i18n;
@@ -99,7 +100,7 @@ sal_Int32 ScriptTypeDetector::beginOfCTLScriptType( std::u16string_view Text, sa
{
if (nPos < 0)
return 0;
- else if (nPos >= static_cast<sal_Int32>(Text.size()))
+ else if (o3tl::make_unsigned(nPos) >= Text.size())
return Text.size();
else {
sal_Int16 cType = getCTLScriptType(Text, nPos);
@@ -116,7 +117,7 @@ sal_Int32 ScriptTypeDetector::endOfCTLScriptType( std::u16string_view Text, sal_
{
if (nPos < 0)
return 0;
- else if (nPos >= static_cast<sal_Int32>(Text.size()))
+ else if (o3tl::make_unsigned(nPos) >= Text.size())
return Text.size();
else {
sal_Int16 cType = getCTLScriptType(Text, nPos);