mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 20:29:17 +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
|
||||||
P1 = P2 = 0 }
|
P1 = P2 = 0 }
|
||||||
|
|
||||||
function CompareMemRange(P1, P2: Pointer; Length: cardinal): integer;
|
function CompareMemRange(P1, P2: Pointer; Length: PtrUInt): integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
|
|
||||||
var
|
|
||||||
i: cardinal;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
i := 0;
|
Result:=CompareByte(P1^,P2^,Length);
|
||||||
result := 0;
|
end;
|
||||||
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 ;
|
|
||||||
|
|
||||||
function CompareMem(P1, P2: Pointer; Length: cardinal): Boolean;
|
function CompareMem(P1, P2: Pointer; Length: PtrUInt): Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
var
|
|
||||||
i: cardinal;
|
|
||||||
begin
|
begin
|
||||||
Result:=True;
|
Result:=CompareByte(P1^,P2^,Length)=0;
|
||||||
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;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,8 +80,8 @@ function LowerCase(const s: string): string; overload;
|
|||||||
version for a variant }
|
version for a variant }
|
||||||
function LowerCase(const V: variant): string; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function LowerCase(const V: variant): string; overload;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function CompareStr(const S1, S2: string): Integer; overload;
|
function CompareStr(const S1, S2: string): Integer; overload;
|
||||||
function CompareMemRange(P1, P2: Pointer; Length: cardinal): integer;
|
function CompareMemRange(P1, P2: Pointer; Length: PtrUInt): integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function CompareMem(P1, P2: Pointer; Length: cardinal): Boolean;
|
function CompareMem(P1, P2: Pointer; Length: PtrUInt): Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function CompareText(const S1, S2: string): integer;
|
function CompareText(const S1, S2: string): integer;
|
||||||
function SameText(const s1,s2:String):Boolean;
|
function SameText(const s1,s2:String):Boolean;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user