mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-06 14:08:15 +01: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
|
for i := 0 to Count - 2 do
|
||||||
begin
|
begin
|
||||||
if AnsiCompareText(Strings[i], Strings[i + 1]) < 0 then
|
if DoCompareText(Strings[i], Strings[i + 1]) < 0 then
|
||||||
begin
|
begin
|
||||||
Sort;
|
Sort;
|
||||||
Break;
|
Break;
|
||||||
@ -550,12 +550,12 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TGtkListStoreStringList.Sort;
|
procedure TGtkListStoreStringList.Sort;
|
||||||
var
|
var
|
||||||
sl: TStringListUTF8Fast;
|
sl: TStringList;
|
||||||
OldSorted: Boolean;
|
OldSorted: Boolean;
|
||||||
begin
|
begin
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
// sort internally (sorting in the widget would be slow and unpretty ;)
|
// sort internally (sorting in the widget would be slow and unpretty ;)
|
||||||
sl := TStringListUTF8Fast.Create;
|
sl := TStringList.Create;
|
||||||
sl.Assign(Self);
|
sl.Assign(Self);
|
||||||
sl.Sort;
|
sl.Sort;
|
||||||
OldSorted := Sorted;
|
OldSorted := Sorted;
|
||||||
@ -623,7 +623,7 @@ begin
|
|||||||
// => don't change if the content is already the same
|
// => don't change if the content is already the same
|
||||||
if Sorted then
|
if Sorted then
|
||||||
begin
|
begin
|
||||||
CmpList := TStringListUTF8Fast.Create;
|
CmpList := TStringList.Create;
|
||||||
CmpList.Assign(TStrings(Source));
|
CmpList.Assign(TStrings(Source));
|
||||||
TStringList(CmpList).Sort;
|
TStringList(CmpList).Sort;
|
||||||
end
|
end
|
||||||
@ -833,7 +833,7 @@ begin
|
|||||||
while (L <= R) do
|
while (L <= R) do
|
||||||
begin
|
begin
|
||||||
I := L + (R - L) div 2;
|
I := L + (R - L) div 2;
|
||||||
CompareRes := AnsiCompareText(S, Strings[I]);
|
CompareRes := DoCompareText(S, Strings[I]);
|
||||||
if (CompareRes > 0) then
|
if (CompareRes > 0) then
|
||||||
L := I + 1
|
L := I + 1
|
||||||
else
|
else
|
||||||
|
|||||||
@ -497,11 +497,11 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TGtkListStringList.Sort;
|
procedure TGtkListStringList.Sort;
|
||||||
var
|
var
|
||||||
sl: TStringListUTF8Fast;
|
sl: TStringList;
|
||||||
begin
|
begin
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
// sort internally (sorting in the widget would be slow and unpretty ;)
|
// sort internally (sorting in the widget would be slow and unpretty ;)
|
||||||
sl:=TStringListUTF8Fast.Create;
|
sl:=TStringList.Create;
|
||||||
sl.Assign(Self);
|
sl.Assign(Self);
|
||||||
sl.Sort; // currently this is quicksort ->
|
sl.Sort; // currently this is quicksort ->
|
||||||
// Disadvantages: - worst case on sorted list
|
// Disadvantages: - worst case on sorted list
|
||||||
@ -517,7 +517,7 @@ function TGtkListStringList.IsEqual(List: TStrings;
|
|||||||
CompareObjects: boolean): boolean;
|
CompareObjects: boolean): boolean;
|
||||||
var
|
var
|
||||||
i, Cnt: integer;
|
i, Cnt: integer;
|
||||||
CmpList: TStringListUTF8Fast;
|
CmpList: TStringList;
|
||||||
begin
|
begin
|
||||||
if List=Self then begin
|
if List=Self then begin
|
||||||
Result:=true;
|
Result:=true;
|
||||||
@ -528,7 +528,7 @@ begin
|
|||||||
Cnt:=Count;
|
Cnt:=Count;
|
||||||
if (Cnt<>List.Count) then exit;
|
if (Cnt<>List.Count) then exit;
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
CmpList:=TStringListUTF8Fast.Create;
|
CmpList:=TStringList.Create;
|
||||||
try
|
try
|
||||||
CmpList.Assign(List);
|
CmpList.Assign(List);
|
||||||
CmpList.Sorted:=FSorted;
|
CmpList.Sorted:=FSorted;
|
||||||
|
|||||||
@ -24,7 +24,7 @@ uses
|
|||||||
// RTL, FCL, libs
|
// RTL, FCL, libs
|
||||||
Math, Sysutils, Classes, GLib2, Gtk2, Gdk2, Gdk2pixbuf,
|
Math, Sysutils, Classes, GLib2, Gtk2, Gdk2, Gdk2pixbuf,
|
||||||
// LazUtils
|
// LazUtils
|
||||||
LazTracer, LazUTF8,
|
LazTracer,
|
||||||
// LCL
|
// LCL
|
||||||
LCLType, LCLIntf, LMessages, Controls, Graphics, ComCtrls, StdCtrls, Forms,
|
LCLType, LCLIntf, LMessages, Controls, Graphics, ComCtrls, StdCtrls, Forms,
|
||||||
ImgList, InterfaceBase,
|
ImgList, InterfaceBase,
|
||||||
|
|||||||
@ -1745,7 +1745,7 @@ begin
|
|||||||
New(Widgets);
|
New(Widgets);
|
||||||
with Widgets^ do
|
with Widgets^ do
|
||||||
begin
|
begin
|
||||||
ItemCache := TStringListUTF8Fast.Create;
|
ItemCache := TStringList.Create;
|
||||||
Images := nil;
|
Images := nil;
|
||||||
OldTreeSelection := nil;
|
OldTreeSelection := nil;
|
||||||
|
|
||||||
|
|||||||
@ -23,8 +23,6 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils,
|
Classes, SysUtils,
|
||||||
// LazUtils
|
|
||||||
LazUTF8,
|
|
||||||
// LCL
|
// LCL
|
||||||
Controls, LazGtk3, LazGObject2, LazGLib2;
|
Controls, LazGtk3, LazGObject2, LazGLib2;
|
||||||
|
|
||||||
@ -320,12 +318,12 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TGtkListStoreStringList.Sort;
|
procedure TGtkListStoreStringList.Sort;
|
||||||
var
|
var
|
||||||
sl: TStringListUTF8Fast;
|
sl: TStringList;
|
||||||
OldSorted: Boolean;
|
OldSorted: Boolean;
|
||||||
begin
|
begin
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
// sort internally (sorting in the widget would be slow and unpretty ;)
|
// sort internally (sorting in the widget would be slow and unpretty ;)
|
||||||
sl := TStringListUTF8Fast.Create;
|
sl := TStringList.Create;
|
||||||
sl.Assign(Self);
|
sl.Assign(Self);
|
||||||
sl.Sort;
|
sl.Sort;
|
||||||
OldSorted := Sorted;
|
OldSorted := Sorted;
|
||||||
@ -393,7 +391,7 @@ begin
|
|||||||
// => don't change if the content is already the same
|
// => don't change if the content is already the same
|
||||||
if Sorted then
|
if Sorted then
|
||||||
begin
|
begin
|
||||||
CmpList := TStringListUTF8Fast.Create;
|
CmpList := TStringList.Create;
|
||||||
CmpList.Assign(TStrings(Source));
|
CmpList.Assign(TStrings(Source));
|
||||||
TStringList(CmpList).Sort;
|
TStringList(CmpList).Sort;
|
||||||
end
|
end
|
||||||
|
|||||||
@ -111,7 +111,7 @@ type
|
|||||||
FWidgetNeedFontColorInitialization: Boolean;
|
FWidgetNeedFontColorInitialization: Boolean;
|
||||||
FChildOfComplexWidget: TChildOfComplexWidget;
|
FChildOfComplexWidget: TChildOfComplexWidget;
|
||||||
FOwnWidget: Boolean;
|
FOwnWidget: Boolean;
|
||||||
FProps: TStringListUTF8Fast;
|
FProps: TStringList;
|
||||||
FPaintData: TPaintData;
|
FPaintData: TPaintData;
|
||||||
FCentralWidget: QWidgetH;
|
FCentralWidget: QWidgetH;
|
||||||
FContext: HDC;
|
FContext: HDC;
|
||||||
@ -5643,7 +5643,7 @@ var
|
|||||||
begin
|
begin
|
||||||
if FProps=nil then
|
if FProps=nil then
|
||||||
begin
|
begin
|
||||||
FProps:=TStringListUTF8Fast.Create;
|
FProps:=TStringList.Create;
|
||||||
FProps.Sorted:=true;
|
FProps.Sorted:=true;
|
||||||
end;
|
end;
|
||||||
i := Fprops.IndexOf(AnIndex);
|
i := Fprops.IndexOf(AnIndex);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user