diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-08-11 09:43:46 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-08-11 20:44:16 +0200 |
commit | ea1e005cb18cbd4fe9ceda725aac47bbfb068389 (patch) | |
tree | 4bc1ad26137362e508d653a175359a5807dcc93a /src/corelib/text/qunicodetools.cpp | |
parent | 6f976a4c7d36c5ff631ff4a8afa145c365fb4439 (diff) |
QUnicodeTools: fix types used around th_next_cell
Libthai's th_next_cell takes and returns lengths as size_t.
- pass size_t, not qsizetype (the value can never be negative)
- receive size_t, don't cast to uint
As a drive-by, scope variables tighter.
Task-number: QTBUG-103531
Pick-to: 6.4 6.3 6.2
Change-Id: Ib1eeb1f0e8974ee8b0f88d080d06136b307c324f
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/text/qunicodetools.cpp')
-rw-r--r-- | src/corelib/text/qunicodetools.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/text/qunicodetools.cpp b/src/corelib/text/qunicodetools.cpp index beef159daa..0d9935b142 100644 --- a/src/corelib/text/qunicodetools.cpp +++ b/src/corelib/text/qunicodetools.cpp @@ -1445,7 +1445,7 @@ static void thaiAssignAttributes(const char16_t *string, qsizetype len, QCharAtt int *break_positions = nullptr; int brp[128]; int brp_size = 0; - qsizetype numbreaks, i, j, cell_length; + qsizetype numbreaks, i; struct thcell_t tis_cell; if (!init_libthai()) @@ -1494,11 +1494,12 @@ static void thaiAssignAttributes(const char16_t *string, qsizetype len, QCharAtt /* manage grapheme boundaries */ i = 0; while (i < len) { - cell_length = static_cast<uint>(th_next_cell(reinterpret_cast<const unsigned char *>(cstr) + i, len - i, &tis_cell, true)); + size_t cell_length = th_next_cell(reinterpret_cast<const unsigned char *>(cstr) + i, + size_t(len - i), &tis_cell, true); attributes[i].graphemeBoundary = true; - for (j = 1; j < cell_length; j++) + for (size_t j = 1; j < cell_length; ++j) attributes[i + j].graphemeBoundary = false; i += cell_length; |