mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 22:47:54 +02:00
* change length parameter of CompareMem/CompareMemRange into PtrUInt, resolves #15190
* use CompareByte inside these routines instead of simple handmade code git-svn-id: trunk@14435 -
This commit is contained in:
parent
7a82669942
commit
230142f08b
@ -159,37 +159,14 @@ end;
|
||||
P1 > P2 > 0
|
||||
P1 = P2 = 0 }
|
||||
|
||||
function CompareMemRange(P1, P2: Pointer; Length: cardinal): integer;
|
||||
|
||||
var
|
||||
i: cardinal;
|
||||
|
||||
function CompareMemRange(P1, P2: Pointer; Length: PtrUInt): integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||
begin
|
||||
i := 0;
|
||||
result := 0;
|
||||
while (result=0) and (I<length) do
|
||||
begin
|
||||
result:=byte(P1^)-byte(P2^);
|
||||
P1:=pchar(P1)+1; // VP compat.
|
||||
P2:=pchar(P2)+1;
|
||||
i := i + 1;
|
||||
end ;
|
||||
end ;
|
||||
Result:=CompareByte(P1^,P2^,Length);
|
||||
end;
|
||||
|
||||
function CompareMem(P1, P2: Pointer; Length: cardinal): Boolean;
|
||||
var
|
||||
i: cardinal;
|
||||
function CompareMem(P1, P2: Pointer; Length: PtrUInt): Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||
begin
|
||||
Result:=True;
|
||||
I:=0;
|
||||
If (P1)<>(P2) then
|
||||
While Result and (i<Length) do
|
||||
begin
|
||||
Result:=PByte(P1)^=PByte(P2)^;
|
||||
Inc(I);
|
||||
Inc(pchar(P1));
|
||||
Inc(pchar(P2));
|
||||
end;
|
||||
Result:=CompareByte(P1^,P2^,Length)=0;
|
||||
end;
|
||||
|
||||
|
||||
|
@ -80,8 +80,8 @@ function LowerCase(const s: string): string; overload;
|
||||
version for a variant }
|
||||
function LowerCase(const V: variant): string; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||
function CompareStr(const S1, S2: string): Integer; overload;
|
||||
function CompareMemRange(P1, P2: Pointer; Length: cardinal): integer;
|
||||
function CompareMem(P1, P2: Pointer; Length: cardinal): Boolean;
|
||||
function CompareMemRange(P1, P2: Pointer; Length: PtrUInt): integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||
function CompareMem(P1, P2: Pointer; Length: PtrUInt): Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||
function CompareText(const S1, S2: string): integer;
|
||||
function SameText(const s1,s2:String):Boolean;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user