mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-01 04:29:29 +02:00
lcl: fix search in StringHashList by Mattias Hansson (issue #0014551)
git-svn-id: trunk@23061 -
This commit is contained in:
parent
4a17d26613
commit
0fcd4927f4
@ -243,16 +243,18 @@ begin
|
||||
begin
|
||||
Result:= -1;
|
||||
First:= Temp -1;
|
||||
if First > 0 then
|
||||
while CompareValue(Value, FList[First]^.HashValue) = 0 do
|
||||
//Find first matching hash index
|
||||
while (First >= 0) and (CompareValue(Value, FList[First]^.HashValue) = 0) do
|
||||
dec(First);
|
||||
inc(First);
|
||||
if (First < 0) or ((CompareValue(Value, FList[First]^.HashValue) <> 0)) then
|
||||
inc(First);
|
||||
//Find the last matching hash index
|
||||
Last:= Temp +1;
|
||||
if Last < Count -1 then
|
||||
while CompareValue(Value, FList[Last]^.HashValue) = 0 do
|
||||
while (Last <= (FCount - 1)) and (CompareValue(Value, FList[Last]^.HashValue) = 0) do
|
||||
inc(Last);
|
||||
dec(Last);
|
||||
for I:= First to Last do
|
||||
if (Last > (FCount - 1)) or (CompareValue(Value, FList[Last]^.HashValue) <> 0) then
|
||||
dec(Last);
|
||||
for I := First to Last do
|
||||
if CompareString(S, FList[I]^.Key) then
|
||||
begin
|
||||
Result:= I;
|
||||
|
Loading…
Reference in New Issue
Block a user