summaryrefslogtreecommitdiff
path: root/hwpfilter
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-04-26 15:08:36 +0200
committerStephan Bergmann <sbergman@redhat.com>2022-04-26 17:04:01 +0200
commitbdff0bb77b57def835fcaed3bded7519e69dc896 (patch)
treec330add464f566a32ebd82dd9ad29f91ba0d87f8 /hwpfilter
parent651527b4efe9700c8c8dff58ce5aa86ad5681f16 (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: I9665e6c2c4c5557f2d4cf1bb646f9fffc7bd7d30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133442 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'hwpfilter')
-rw-r--r--hwpfilter/source/hcode.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/hwpfilter/source/hcode.cxx b/hwpfilter/source/hcode.cxx
index a02e689d28d6..cc9d051ca07b 100644
--- a/hwpfilter/source/hcode.cxx
+++ b/hwpfilter/source/hcode.cxx
@@ -30,6 +30,7 @@
#include <comphelper/base64.hxx>
#include <comphelper/sequence.hxx>
#include <basegfx/numeric/ftools.hxx>
+#include <o3tl/safeint.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/types.h>
@@ -1147,7 +1148,7 @@ hchar ksc5601_sym_to_ucs2 (hchar input)
unsigned char ch = sal::static_int_cast<unsigned char>(input >> 8);
unsigned char ch2 = sal::static_int_cast<unsigned char>(input & 0xff);
int idx = (ch - 0xA1) * 94 + (ch2 - 0xA1);
- if (idx >= 0 && idx < static_cast<int>(SAL_N_ELEMENTS(ksc5601_2uni_page21))) {
+ if (idx >= 0 && o3tl::make_unsigned(idx) < SAL_N_ELEMENTS(ksc5601_2uni_page21)) {
hchar value = ksc5601_2uni_page21[idx];
return value ? value : 0x25a1;
}
@@ -1159,7 +1160,7 @@ hchar ksc5601_han_to_ucs2 (hchar input)
unsigned char ch = sal::static_int_cast<unsigned char>(input >> 8);
unsigned char ch2 = sal::static_int_cast<unsigned char>(input & 0xff);
int idx = (ch - 0xA1) * 94 + (ch2 - 0xA1);
- if (idx >= 3854 && idx < static_cast<int>(3854 + SAL_N_ELEMENTS(ksc5601_2uni_page21))) {
+ if (idx >= 3854 && o3tl::make_unsigned(idx) < 3854 + SAL_N_ELEMENTS(ksc5601_2uni_page21)) {
// Hanja : row 42 - row 93 : 3854 = 94 * (42-1)
hchar value = ksc5601_2uni_page21[idx - 3854];
return value ? value : '?';