From d0d845644b5f13619b34b2ad971740e0740fe97e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 11 Aug 2022 09:43:46 +0200 Subject: [PATCH] QUnicodeTools: fix types used around th_brk() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Mårten Nordheim (cherry picked from commit 50d1a8a3770df7ada3ef558db449c758444234bf) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/text/qunicodetools.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/text/qunicodetools.cpp b/src/corelib/text/qunicodetools.cpp index 3c1ee897a43..5203e46feb1 100644 --- a/src/corelib/text/qunicodetools.cpp +++ b/src/corelib/text/qunicodetools.cpp @@ -1478,7 +1478,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; @@ -1500,7 +1500,7 @@ static void thaiAssignAttributes(const char16_t *string, qsizetype len, QCharAtt if (len > 128) { break_positions = static_cast(malloc (sizeof(int) * len)); memset (break_positions, 0, sizeof(int) * len); - brp_size = len; + brp_size = size_t(len); } else { break_positions = brp;