* Remove usage of HasKey (bug ID 29820

git-svn-id: trunk@33226 -
This commit is contained in:
michael 2016-03-12 17:19:22 +00:00
parent ebc5a637fa
commit 18296c258f

View File

@ -1956,13 +1956,7 @@ end;
Function THTCustomNode.HasKey(const AKey: string): boolean; Function THTCustomNode.HasKey(const AKey: string): boolean;
begin begin
if Length(AKey) <> Length(FKey) then Result:=(AKey=FKey);
begin
Result:=false;
Exit;
end
else
Result:=CompareMem(PChar(FKey), PChar(AKey), Length(AKey));
end; end;
{ TFPCustomHashTable } { TFPCustomHashTable }
@ -2070,11 +2064,8 @@ begin
if Assigned(chn) then if Assigned(chn) then
if chn.count>0 then if chn.count>0 then
for i:=0 to chn.Count - 1 do for i:=0 to chn.Count - 1 do
if THTCustomNode(chn[i]).HasKey(aKey) then if THTCustomNode(chn[i]).Key=aKey then
begin Exit(THTCustomNode(chn[i]));
Result:=THTCustomNode(chn[i]);
Exit;
end;
Result:=nil; Result:=nil;
end; end;
@ -2089,7 +2080,7 @@ begin
begin begin
if Result.count>0 then if Result.count>0 then
for i:=0 to Result.Count - 1 do for i:=0 to Result.Count - 1 do
if THTCustomNode(Result[i]).HasKey(aKey) then if (THTCustomNode(Result[i]).Key=aKey) then
raise EDuplicate.CreateFmt(DuplicateMsg, [aKey]); raise EDuplicate.CreateFmt(DuplicateMsg, [aKey]);
end end
else else
@ -2112,7 +2103,7 @@ begin
if Assigned(chn) then if Assigned(chn) then
if chn.count>0 then if chn.count>0 then
for i:=0 to chn.Count - 1 do for i:=0 to chn.Count - 1 do
if THTCustomNode(chn[i]).HasKey(aKey) then if THTCustomNode(chn[i]).Key=aKey then
begin begin
chn.Delete(i); chn.Delete(i);
dec(FCount); dec(FCount);
@ -2176,11 +2167,8 @@ begin
begin begin
if chn.count>0 then if chn.count>0 then
for i:=0 to chn.Count - 1 do for i:=0 to chn.Count - 1 do
if THTCustomNode(chn[i]).HasKey(aKey) then if (THTCustomNode(chn[i]).Key=aKey) then
begin Exit(THTNode(chn[i]));
Result:=THTNode(chn[i]);
Exit;
end
end end
else else
begin begin