From 1c2402a14a26398aee839228ce75d5b7a97eca0d Mon Sep 17 00:00:00 2001 From: juha Date: Thu, 11 Mar 2021 18:03:35 +0000 Subject: [PATCH] LCL: Revert some optimizations with TStringListUTF8Fast. It must not be used when locale based sort order is needed. Issue #38612. git-svn-id: trunk@64784 - --- lcl/interfaces/gtk2/gtk2int.pas | 10 +++++----- lcl/interfaces/gtk2/gtk2listsl.inc | 8 ++++---- lcl/interfaces/gtk2/gtk2wscomctrls.pp | 2 +- lcl/interfaces/gtk2/gtk2wscustomlistview.inc | 2 +- lcl/interfaces/gtk3/gtk3private.pas | 8 +++----- lcl/interfaces/qt5/qtwidgets.pas | 4 ++-- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/lcl/interfaces/gtk2/gtk2int.pas b/lcl/interfaces/gtk2/gtk2int.pas index 6e77b0756f..fb4cf5c92c 100644 --- a/lcl/interfaces/gtk2/gtk2int.pas +++ b/lcl/interfaces/gtk2/gtk2int.pas @@ -474,7 +474,7 @@ begin for i := 0 to Count - 2 do begin - if AnsiCompareText(Strings[i], Strings[i + 1]) < 0 then + if DoCompareText(Strings[i], Strings[i + 1]) < 0 then begin Sort; Break; @@ -550,12 +550,12 @@ end; ------------------------------------------------------------------------------} procedure TGtkListStoreStringList.Sort; var - sl: TStringListUTF8Fast; + sl: TStringList; OldSorted: Boolean; begin BeginUpdate; // sort internally (sorting in the widget would be slow and unpretty ;) - sl := TStringListUTF8Fast.Create; + sl := TStringList.Create; sl.Assign(Self); sl.Sort; OldSorted := Sorted; @@ -623,7 +623,7 @@ begin // => don't change if the content is already the same if Sorted then begin - CmpList := TStringListUTF8Fast.Create; + CmpList := TStringList.Create; CmpList.Assign(TStrings(Source)); TStringList(CmpList).Sort; end @@ -833,7 +833,7 @@ begin while (L <= R) do begin I := L + (R - L) div 2; - CompareRes := AnsiCompareText(S, Strings[I]); + CompareRes := DoCompareText(S, Strings[I]); if (CompareRes > 0) then L := I + 1 else diff --git a/lcl/interfaces/gtk2/gtk2listsl.inc b/lcl/interfaces/gtk2/gtk2listsl.inc index e927c5e608..acb5905473 100644 --- a/lcl/interfaces/gtk2/gtk2listsl.inc +++ b/lcl/interfaces/gtk2/gtk2listsl.inc @@ -497,11 +497,11 @@ end; ------------------------------------------------------------------------------} procedure TGtkListStringList.Sort; var - sl: TStringListUTF8Fast; + sl: TStringList; begin BeginUpdate; // sort internally (sorting in the widget would be slow and unpretty ;) - sl:=TStringListUTF8Fast.Create; + sl:=TStringList.Create; sl.Assign(Self); sl.Sort; // currently this is quicksort -> // Disadvantages: - worst case on sorted list @@ -517,7 +517,7 @@ function TGtkListStringList.IsEqual(List: TStrings; CompareObjects: boolean): boolean; var i, Cnt: integer; - CmpList: TStringListUTF8Fast; + CmpList: TStringList; begin if List=Self then begin Result:=true; @@ -528,7 +528,7 @@ begin Cnt:=Count; if (Cnt<>List.Count) then exit; BeginUpdate; - CmpList:=TStringListUTF8Fast.Create; + CmpList:=TStringList.Create; try CmpList.Assign(List); CmpList.Sorted:=FSorted; diff --git a/lcl/interfaces/gtk2/gtk2wscomctrls.pp b/lcl/interfaces/gtk2/gtk2wscomctrls.pp index 0b6cf2b2ec..359e4fc9f6 100644 --- a/lcl/interfaces/gtk2/gtk2wscomctrls.pp +++ b/lcl/interfaces/gtk2/gtk2wscomctrls.pp @@ -24,7 +24,7 @@ uses // RTL, FCL, libs Math, Sysutils, Classes, GLib2, Gtk2, Gdk2, Gdk2pixbuf, // LazUtils - LazTracer, LazUTF8, + LazTracer, // LCL LCLType, LCLIntf, LMessages, Controls, Graphics, ComCtrls, StdCtrls, Forms, ImgList, InterfaceBase, diff --git a/lcl/interfaces/gtk2/gtk2wscustomlistview.inc b/lcl/interfaces/gtk2/gtk2wscustomlistview.inc index 7ecac0593a..4cd9bfa637 100644 --- a/lcl/interfaces/gtk2/gtk2wscustomlistview.inc +++ b/lcl/interfaces/gtk2/gtk2wscustomlistview.inc @@ -1745,7 +1745,7 @@ begin New(Widgets); with Widgets^ do begin - ItemCache := TStringListUTF8Fast.Create; + ItemCache := TStringList.Create; Images := nil; OldTreeSelection := nil; diff --git a/lcl/interfaces/gtk3/gtk3private.pas b/lcl/interfaces/gtk3/gtk3private.pas index d0c91887ab..1c9571c9fb 100644 --- a/lcl/interfaces/gtk3/gtk3private.pas +++ b/lcl/interfaces/gtk3/gtk3private.pas @@ -23,8 +23,6 @@ interface uses Classes, SysUtils, - // LazUtils - LazUTF8, // LCL Controls, LazGtk3, LazGObject2, LazGLib2; @@ -320,12 +318,12 @@ end; ------------------------------------------------------------------------------} procedure TGtkListStoreStringList.Sort; var - sl: TStringListUTF8Fast; + sl: TStringList; OldSorted: Boolean; begin BeginUpdate; // sort internally (sorting in the widget would be slow and unpretty ;) - sl := TStringListUTF8Fast.Create; + sl := TStringList.Create; sl.Assign(Self); sl.Sort; OldSorted := Sorted; @@ -393,7 +391,7 @@ begin // => don't change if the content is already the same if Sorted then begin - CmpList := TStringListUTF8Fast.Create; + CmpList := TStringList.Create; CmpList.Assign(TStrings(Source)); TStringList(CmpList).Sort; end diff --git a/lcl/interfaces/qt5/qtwidgets.pas b/lcl/interfaces/qt5/qtwidgets.pas index 0548ec3436..edb13a119f 100644 --- a/lcl/interfaces/qt5/qtwidgets.pas +++ b/lcl/interfaces/qt5/qtwidgets.pas @@ -111,7 +111,7 @@ type FWidgetNeedFontColorInitialization: Boolean; FChildOfComplexWidget: TChildOfComplexWidget; FOwnWidget: Boolean; - FProps: TStringListUTF8Fast; + FProps: TStringList; FPaintData: TPaintData; FCentralWidget: QWidgetH; FContext: HDC; @@ -5643,7 +5643,7 @@ var begin if FProps=nil then begin - FProps:=TStringListUTF8Fast.Create; + FProps:=TStringList.Create; FProps.Sorted:=true; end; i := Fprops.IndexOf(AnIndex);