mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 13:49:17 +02:00
* Revert Integer -> SizeInt change where appropriate, capping result when needed
git-svn-id: trunk@33327 -
This commit is contained in:
parent
cf3230b100
commit
2b077f6af3
@ -133,8 +133,24 @@ function LowerCase(const V: variant): string; overload;{$ifdef SYSUTILSINLINE}in
|
|||||||
S1 > S2 > 0
|
S1 > S2 > 0
|
||||||
S1 = S2 = 0 }
|
S1 = S2 = 0 }
|
||||||
|
|
||||||
function CompareStr(const S1, S2: string): SizeInt;
|
{$IF SIZEOF(SIZEINT)>SIZEOF(INTEGER)}
|
||||||
var count, count1, count2: SizeInt;
|
Function DoCapSizeInt(SI : SizeInt) : Integer; inline;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if (SI<0) then
|
||||||
|
result:=-1
|
||||||
|
else if (SI>0) then
|
||||||
|
result:=1
|
||||||
|
else
|
||||||
|
result:=0;
|
||||||
|
end;
|
||||||
|
{$DEFINE CAPSIZEINT:=DoCapSizeInt}
|
||||||
|
{$ELSE}
|
||||||
|
{$DEFINE CAPSIZEINT:=}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
function CompareStr(const S1, S2: string): Integer;
|
||||||
|
var res,count, count1, count2: SizeInt;
|
||||||
begin
|
begin
|
||||||
result := 0;
|
result := 0;
|
||||||
Count1 := Length(S1);
|
Count1 := Length(S1);
|
||||||
@ -145,7 +161,8 @@ begin
|
|||||||
Count:=Count1;
|
Count:=Count1;
|
||||||
result := CompareMemRange(Pointer(S1),Pointer(S2), Count);
|
result := CompareMemRange(Pointer(S1),Pointer(S2), Count);
|
||||||
if result=0 then
|
if result=0 then
|
||||||
result:=Count1-Count2;
|
// CAPSIZEINT is no-op if Sizeof(Sizeint)<=SizeOF(Integer)
|
||||||
|
result:=CAPSIZEINT(Count1-Count2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ CompareMemRange returns the result of comparison of Length bytes at P1 and P2
|
{ CompareMemRange returns the result of comparison of Length bytes at P1 and P2
|
||||||
@ -173,10 +190,11 @@ end;
|
|||||||
S1 > S2 > 0
|
S1 > S2 > 0
|
||||||
S1 = S2 = 0 }
|
S1 = S2 = 0 }
|
||||||
|
|
||||||
function CompareText(const S1, S2: string): SizeInt;
|
function CompareText(const S1, S2: string): Integer;
|
||||||
|
|
||||||
var
|
var
|
||||||
i, count, count1, count2: integer; Chr1, Chr2: byte;
|
i, count, count1, count2: sizeint;
|
||||||
|
Chr1, Chr2: byte;
|
||||||
P1, P2: PChar;
|
P1, P2: PChar;
|
||||||
begin
|
begin
|
||||||
Count1 := Length(S1);
|
Count1 := Length(S1);
|
||||||
@ -209,7 +227,8 @@ begin
|
|||||||
if i < Count then
|
if i < Count then
|
||||||
result := Chr1-Chr2
|
result := Chr1-Chr2
|
||||||
else
|
else
|
||||||
result := count1-count2;
|
// CAPSIZEINT is no-op if Sizeof(Sizeint)<=SizeOF(Integer)
|
||||||
|
result:=CAPSIZEINT(Count1-Count2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function SameText(const s1,s2:String):Boolean;
|
function SameText(const s1,s2:String):Boolean;
|
||||||
@ -471,39 +490,45 @@ function AnsiLowerCase(const s: string): string;{$ifdef SYSUTILSINLINE}inline;{$
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function AnsiCompareStr(const S1, S2: string): sizeint;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiCompareStr(const S1, S2: string): integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
begin
|
begin
|
||||||
result:=widestringmanager.CompareStrAnsiStringProc(s1,s2);
|
// CAPSIZEINT is no-op if Sizeof(Sizeint)<=SizeOF(Integer)
|
||||||
|
result:=CAPSIZEINT(widestringmanager.CompareStrAnsiStringProc(s1,s2));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function AnsiCompareText(const S1, S2: string): sizeint;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiCompareText(const S1, S2: string): integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
begin
|
begin
|
||||||
result:=widestringmanager.CompareTextAnsiStringProc(s1,s2);
|
// CAPSIZEINT is no-op if Sizeof(Sizeint)<=SizeOF(Integer)
|
||||||
|
result:=CAPSIZEINT(widestringmanager.CompareTextAnsiStringProc(s1,s2));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function AnsiStrComp(S1, S2: PChar): sizeint;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiStrComp(S1, S2: PChar): integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
begin
|
begin
|
||||||
result:=widestringmanager.StrCompAnsiStringProc(s1,s2);
|
// CAPSIZEINT is no-op if Sizeof(Sizeint)<=SizeOF(Integer)
|
||||||
|
result:=CAPSIZEINT(widestringmanager.StrCompAnsiStringProc(s1,s2));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function AnsiStrIComp(S1, S2: PChar): sizeint;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiStrIComp(S1, S2: PChar): integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
begin
|
begin
|
||||||
result:=widestringmanager.StrICompAnsiStringProc(s1,s2);
|
// CAPSIZEINT is no-op if Sizeof(Sizeint)<=SizeOF(Integer)
|
||||||
|
result:=CAPSIZEINT(widestringmanager.StrICompAnsiStringProc(s1,s2));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function AnsiStrLComp(S1, S2: PChar; MaxLen: SizeUInt): SizeInt;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiStrLComp(S1, S2: PChar; MaxLen: SizeUInt): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
begin
|
begin
|
||||||
result:=widestringmanager.StrLCompAnsiStringProc(s1,s2,maxlen);
|
// CAPSIZEINT is no-op if Sizeof(Sizeint)<=SizeOF(Integer)
|
||||||
|
result:=CAPSIZEINT(widestringmanager.StrLCompAnsiStringProc(s1,s2,maxlen));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function AnsiStrLIComp(S1, S2: PChar; MaxLen: SizeUint): SizeInt;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiStrLIComp(S1, S2: PChar; MaxLen: SizeUint): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
begin
|
begin
|
||||||
result:=widestringmanager.StrLICompAnsiStringProc(s1,s2,maxlen);
|
// CAPSIZEINT is no-op if Sizeof(Sizeint)<=SizeOF(Integer)
|
||||||
|
result:=CAPSIZEINT(widestringmanager.StrLICompAnsiStringProc(s1,s2,maxlen));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,23 +73,23 @@ function LowerCase(const s: string): string; overload;
|
|||||||
{ the compiler can't decide else if it should use the char or the ansistring
|
{ the compiler can't decide else if it should use the char or the ansistring
|
||||||
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): SizeInt; overload;
|
function CompareStr(const S1, S2: string): Integer; overload;
|
||||||
function CompareMemRange(P1, P2: Pointer; Length: PtrUInt): integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
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 CompareMem(P1, P2: Pointer; Length: PtrUInt): Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function CompareText(const S1, S2: string): SizeInt;
|
function CompareText(const S1, S2: string): Integer;
|
||||||
function SameText(const s1,s2:String):Boolean;
|
function SameText(const s1,s2:String):Boolean;
|
||||||
function SameStr(const s1,s2:String):Boolean;
|
function SameStr(const s1,s2:String):Boolean;
|
||||||
|
|
||||||
function AnsiUpperCase(const s: string): string;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiUpperCase(const s: string): string;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function AnsiLowerCase(const s: string): string;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiLowerCase(const s: string): string;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function AnsiCompareStr(const S1, S2: string): SizeInt;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiCompareStr(const S1, S2: string): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function AnsiCompareText(const S1, S2: string): SizeInt;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiCompareText(const S1, S2: string): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function AnsiSameText(const s1,s2:String):Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiSameText(const s1,s2:String):Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function AnsiSameStr(const s1,s2:String):Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiSameStr(const s1,s2:String):Boolean;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function AnsiStrComp(S1, S2: PChar): SizeInt;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiStrComp(S1, S2: PChar): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function AnsiStrIComp(S1, S2: PChar): SizeInt;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiStrIComp(S1, S2: PChar): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function AnsiStrLComp(S1, S2: PChar; MaxLen: SizeUInt): SizeInt;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiStrLComp(S1, S2: PChar; MaxLen: SizeUInt): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function AnsiStrLIComp(S1, S2: PChar; MaxLen: SizeUInt): SizeInt;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiStrLIComp(S1, S2: PChar; MaxLen: SizeUInt): Integer;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function AnsiStrLower(Str: PChar): PChar;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiStrLower(Str: PChar): PChar;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function AnsiStrUpper(Str: PChar): PChar;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
function AnsiStrUpper(Str: PChar): PChar;{$ifdef SYSUTILSINLINE}inline;{$endif}
|
||||||
function AnsiLastChar(const S: string): PChar;
|
function AnsiLastChar(const S: string): PChar;
|
||||||
|
Loading…
Reference in New Issue
Block a user