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>
This commit is contained in:
parent
6f976a4c7d
commit
ea1e005cb1
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user