mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 05:56:02 +02:00
laz2_xml: fixed KeyCompare
git-svn-id: trunk@31705 -
This commit is contained in:
parent
e0b91a2f5e
commit
e5373a2852
@ -401,10 +401,10 @@ end;
|
||||
|
||||
function KeyCompare(const Key1: TXMLUtilString; Key2: Pointer; Key2Len: Integer): Boolean;
|
||||
begin
|
||||
{$IFDEF FPC}
|
||||
{$IF defined(FPC) and (SizeOf(TXMLUtilChar)=2)}
|
||||
Result := (Length(Key1)=Key2Len) and (CompareWord(Pointer(Key1)^, Key2^, Key2Len) = 0);
|
||||
{$ELSE}
|
||||
Result := (Length(Key1)=Key2Len) and CompareMem(Pointer(Key1), Key2, Key2Len*2);
|
||||
Result := (Length(Key1)=Key2Len) and CompareMem(Pointer(Key1), Key2, Key2Len*SizeOf(TXMLUtilChar));
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
@ -497,7 +497,7 @@ begin
|
||||
Result := Entry^;
|
||||
Exit;
|
||||
end;
|
||||
if FCount > FBucketCount then { arbitrary limit, probably too high }
|
||||
if FCount > ((FBucketCount*7) div 8) then
|
||||
begin
|
||||
Resize(FBucketCount * 2);
|
||||
Result := Lookup(Key, KeyLength, Found, CanCreate);
|
||||
|
Loading…
Reference in New Issue
Block a user