From e5373a2852d37d3536a11f9063f52abe49b31e9f Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 15 Jul 2011 22:03:06 +0000 Subject: [PATCH] laz2_xml: fixed KeyCompare git-svn-id: trunk@31705 - --- components/codetools/laz2_xmlutils.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/codetools/laz2_xmlutils.pas b/components/codetools/laz2_xmlutils.pas index 4ed2717bbe..b5f00aa542 100644 --- a/components/codetools/laz2_xmlutils.pas +++ b/components/codetools/laz2_xmlutils.pas @@ -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);