From 27ae911ab9cc00cc52d2426762d2e0ac156cbf3b Mon Sep 17 00:00:00 2001 From: Juha Date: Sun, 11 Aug 2024 11:01:37 +0300 Subject: [PATCH] Lazutils: In UnicodeLowercase initialize tables only when needed. Issue #41060, by a-v-o-dev. --- components/lazutils/lazutf16.pas | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/lazutils/lazutf16.pas b/components/lazutils/lazutf16.pas index a1b543074f..1349327fbc 100644 --- a/components/lazutils/lazutf16.pas +++ b/components/lazutils/lazutf16.pas @@ -1005,15 +1005,16 @@ end; function UnicodeLowercase(u: cardinal): cardinal; begin - if not UnicodeTablesInitialized then - InitUnicodeTables; // Initialize only when needed. if u<$00C0 then begin // most common if (u>=$0041) and (u<=$005A) then Result:=u+32 else Result:=u; - end else + end + else begin + if not UnicodeTablesInitialized then + InitUnicodeTables; // Initialize only when needed. case u of $00C0..$00DE: Result:=UnicodeLower00C0_00DE[u]; $0100..$024E: Result:=UnicodeLower0100_024E[u]; @@ -1029,6 +1030,7 @@ begin $2C60..$2CE2: Result:=UnicodeLower2C60_2CE2[u]; $FF21..$FF3A: Result:=u+32; else Result:=u; + end; end; end;