From 1d7f7a7b0a268e18b86f85991a50ddc5bdc4e560 Mon Sep 17 00:00:00 2001 From: bart <9132501-flyingsheep@users.noreply.gitlab.com> Date: Sat, 27 Sep 2014 15:33:23 +0000 Subject: [PATCH] Masks: fix TMask.Matches() when converting the case alters UTF8Length Issue #0026790). Based on patch by laz-andy. git-svn-id: trunk@46339 - --- components/lazutils/masks.pas | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/lazutils/masks.pas b/components/lazutils/masks.pas index d056bdc82e..10da3e9a91 100644 --- a/components/lazutils/masks.pas +++ b/components/lazutils/masks.pas @@ -289,7 +289,7 @@ var if fCaseSensitive then CharValue := GetCodePoint(AValue,I) else - CharValue := Utf8UpperCase(GetCodePoint(AValue,I)); + CharValue := Utf8LowerCase(GetCodePoint(AValue,I)); end; Inc(FMask.MinLength); @@ -374,6 +374,8 @@ var end; mcAnyChar: begin + //CP := GetCodePoint(S, CharIndex); + //writeln('mcAnyChar: CP = ',UTF8ToConsole(CP),' CharIndex = ',CharIndex); if CharIndex > L then Exit; Inc(CharIndex); end; @@ -411,7 +413,10 @@ begin if fCaseSensitive then S := AFileName else - S := Utf8UpperCase(AFileName); + begin + S := Utf8LowerCase(AFileName); + L := Utf8Length(S); + end; Result := MatchToEnd(0, 1); end;