QUnicodeTools: fix types used around th_brk()

Libthai's th_brk() takes the breakpoints array lengths as size_t, so
use that.

This still doesn't fix thaiAssignAttributes() for ≥ 2 Gi characters,
because th_brk returns break positions in an array of int, thus
limiting any results to the first INT_MAX characters. Created
QTBUG-105541 to track this.

Task-number: QTBUG-103531
Change-Id: Iba468cc9389f4533401bc18dd326c4ca7e85a5da
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 50d1a8a3770df7ada3ef558db449c758444234bf)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-08-11 09:43:46 +02:00 committed by Qt Cherry-pick Bot
parent aa417c6c6a
commit 4729163507

View File

@ -1451,7 +1451,7 @@ static void thaiAssignAttributes(const char16_t *string, qsizetype len, QCharAtt
char *cstr = s;
int *break_positions = nullptr;
int brp[128];
int brp_size = 0;
size_t brp_size = 0;
qsizetype numbreaks, i;
struct thcell_t tis_cell;
@ -1473,7 +1473,7 @@ static void thaiAssignAttributes(const char16_t *string, qsizetype len, QCharAtt
if (len > 128) {
break_positions = static_cast<int *>(malloc (sizeof(int) * len));
memset (break_positions, 0, sizeof(int) * len);
brp_size = len;
brp_size = size_t(len);
}
else {
break_positions = brp;