hwpfilter/source/hbox.cxx |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 39c7f8c9cbe15c42b8bff6301a02de6315dc2416
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Mar 24 20:14:41 2022 +0000
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Mar 28 10:17:28 2022 +0200

    ofz: ensure unsigned index
    
    Change-Id: I38d6238a6eede0188f942229b2fb931614e56309
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132043
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx
index e4f555efa320..2715da1c76bf 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;
             }

Reply via email to