mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 23:18:01 +02:00
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 -
This commit is contained in:
parent
8677154fda
commit
1c2402a14a
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -1745,7 +1745,7 @@ begin
|
||||
New(Widgets);
|
||||
with Widgets^ do
|
||||
begin
|
||||
ItemCache := TStringListUTF8Fast.Create;
|
||||
ItemCache := TStringList.Create;
|
||||
Images := nil;
|
||||
OldTreeSelection := nil;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user