mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 15:29:11 +02:00
* Fix negative values, reverted to strtoint
git-svn-id: trunk@39339 -
This commit is contained in:
parent
c73e831633
commit
566a6d289f
@ -897,45 +897,29 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function InternalStrToInt(C: pchar; Len: integer): integer;
|
function InternalStrToInt(C: pchar; Len: integer): integer;
|
||||||
procedure r;
|
|
||||||
begin
|
Var
|
||||||
raise EConvertError.CreateFmt('"%s" is not a valid digit', [C^]);
|
S : String;
|
||||||
end;
|
|
||||||
var
|
|
||||||
I: Integer;
|
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
for I := 1 to Len do
|
if (Len=0) or (C=Nil) then
|
||||||
begin
|
exit;
|
||||||
case C^ of
|
SetString(S,C,Len);
|
||||||
'0'..'9': Result := Result*10 + Ord(C^)-Ord('0');
|
Result:=StrToInt(S);
|
||||||
#0: break;
|
|
||||||
else
|
|
||||||
r;
|
|
||||||
end;
|
|
||||||
Inc(C);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function InternalStrToInt64(C: pchar; Len: integer): LargeInt;
|
function InternalStrToInt64(C: pchar; Len: integer): Int64;
|
||||||
procedure r;
|
|
||||||
begin
|
Var
|
||||||
raise EConvertError.CreateFmt('"%s" is not a valid digit', [C^]);
|
S : String;
|
||||||
end;
|
|
||||||
var
|
|
||||||
I: Integer;
|
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
for I := 1 to Len do
|
if (Len=0) or (C=Nil) then
|
||||||
begin
|
exit;
|
||||||
case C^ of
|
SetString(S,C,Len);
|
||||||
'0'..'9': Result := Result*10 + Ord(C^)-Ord('0');
|
Result:=StrToInt64(S);
|
||||||
#0: break;
|
|
||||||
else
|
|
||||||
r;
|
|
||||||
end;
|
|
||||||
Inc(C);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function InternalStrToFloat(C: pchar; Len: integer; const Format: TFormatSettings): Extended;
|
function InternalStrToFloat(C: pchar; Len: integer; const Format: TFormatSettings): Extended;
|
||||||
|
Loading…
Reference in New Issue
Block a user