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
Pick-to: 6.4 6.3 6.2
Change-Id: Iba468cc9389f4533401bc18dd326c4ca7e85a5da
Reviewed-by: Lars Knoll <lars.knoll@gmail.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Marc Mutz 2022-08-11 09:43:46 +02:00
parent ea1e005cb1
commit 50d1a8a377

View File

@ -1444,7 +1444,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;
@ -1466,7 +1466,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;