summaryrefslogtreecommitdiffstats
path: root/hwpfilter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-03-24 20:14:41 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-03-25 00:10:45 +0100
commite8c95b796626cb9db163f5d563fa67f38a5e92b0 (patch)
tree080a6441238d6dac25eba1bb0e6f7b786eada80c /hwpfilter
parentuitest: sc: remove tests not testing anything in particular (diff)
downloadcore-e8c95b796626cb9db163f5d563fa67f38a5e92b0.tar.gz
core-e8c95b796626cb9db163f5d563fa67f38a5e92b0.zip
ofz: ensure unsigned index
Change-Id: I38d6238a6eede0188f942229b2fb931614e56309 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132090 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'hwpfilter')
-rw-r--r--hwpfilter/source/hbox.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx
index ed477155f7b9..59b0285926fb 100644
--- a/hwpfilter/source/hbox.cxx
+++ b/hwpfilter/source/hbox.cxx
@@ -175,7 +175,7 @@ hchar_string DateCode::GetString()
case '@':
{
static_assert((std::size(eng_mon) - 1) / 3 == 12);
- size_t nIndex = (date[MONTH] - 1) % 12;
+ size_t nIndex = o3tl::make_unsigned(date[MONTH] - 1) % 12;
memcpy(cbuf, eng_mon + nIndex * 3, 3);
cbuf[3] = '.';
cbuf[4] = 0;
@@ -183,7 +183,7 @@ hchar_string DateCode::GetString()
}
case '*':
{
- size_t nIndex = (date[MONTH] - 1) % std::size(en_mon);
+ size_t nIndex = o3tl::make_unsigned(date[MONTH] - 1) % std::size(en_mon);
strncat(cbuf, en_mon[nIndex], sizeof(cbuf) - strlen(cbuf) - 1);
break;
}
@@ -220,14 +220,14 @@ hchar_string DateCode::GetString()
break;
case '6':
{
- size_t nIndex = date[WEEK] % std::size(kor_week);
+ size_t nIndex = o3tl::make_unsigned(date[WEEK]) % std::size(kor_week);
ret.push_back(kor_week[nIndex]);
break;
}
case '^':
{
static_assert((std::size(eng_week) - 1) / 3 == 7);
- size_t nIndex = date[WEEK] % 7;
+ size_t nIndex = o3tl::make_unsigned(date[WEEK]) % 7;
memcpy(cbuf, eng_week + nIndex * 3, 3);
cbuf[3] = '.';
cbuf[4] = 0;
@@ -235,7 +235,7 @@ hchar_string DateCode::GetString()
}
case '_':
{
- size_t nIndex = date[WEEK] % std::size(en_week);
+ size_t nIndex = o3tl::make_unsigned(date[WEEK]) % std::size(en_week);
strncat(cbuf, en_week[nIndex], sizeof(cbuf) - strlen(cbuf) - 1);
break;
}
@@ -274,7 +274,7 @@ hchar_string DateCode::GetString()
fmt++;
if (*fmt == '6')
{
- size_t nIndex = date[WEEK] % std::size(china_week);
+ size_t nIndex = o3tl::make_unsigned(date[WEEK]) % std::size(china_week);
ret.push_back(china_week[nIndex]);
break;
}