mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-19 13:12:43 +02:00
* fixed rangecheck error in format()
This commit is contained in:
parent
965d9de658
commit
6b3063c795
@ -608,9 +608,10 @@ Var ChPos,OldPos,ArgPos,DoArg,Len : Longint;
|
|||||||
begin
|
begin
|
||||||
If Value<>-1 then exit; // Was already read.
|
If Value<>-1 then exit; // Was already read.
|
||||||
OldPos:=chPos;
|
OldPos:=chPos;
|
||||||
While (Chpos<Len) and
|
While (Chpos<=Len) and
|
||||||
(Pos(Fmt[chpos],'1234567890')<>0) do inc(chpos);
|
(Pos(Fmt[chpos],'1234567890')<>0) do inc(chpos);
|
||||||
If Chpos=len then DoFormatError(feInvalidFormat);
|
If Chpos>len then
|
||||||
|
DoFormatError(feInvalidFormat);
|
||||||
If Fmt[Chpos]='*' then
|
If Fmt[Chpos]='*' then
|
||||||
begin
|
begin
|
||||||
If (Chpos>OldPos) or (ArgPos>High(Args))
|
If (Chpos>OldPos) or (ArgPos>High(Args))
|
||||||
@ -741,14 +742,14 @@ Const Zero = '000000000000000000000000000000000000000000000000000000000000000';
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
Len:=Length(Fmt)+1;
|
Len:=Length(Fmt);
|
||||||
Chpos:=1;
|
Chpos:=1;
|
||||||
OldPos:=1;
|
OldPos:=1;
|
||||||
ArgPos:=0;
|
ArgPos:=0;
|
||||||
While chpos<len do
|
While chpos<=len do
|
||||||
begin
|
begin
|
||||||
// uses shortcut evaluation !!
|
While (ChPos<=Len) and (Fmt[chpos]<>'%') do
|
||||||
While (ChPos<=Len) and (Fmt[chpos]<>'%') do inc(chpos);
|
inc(chpos);
|
||||||
If ChPos>OldPos Then
|
If ChPos>OldPos Then
|
||||||
Result:=Result+Copy(Fmt,OldPos,Chpos-Oldpos);
|
Result:=Result+Copy(Fmt,OldPos,Chpos-Oldpos);
|
||||||
If ChPos<Len then
|
If ChPos<Len then
|
||||||
@ -1137,7 +1138,10 @@ const
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.29 1999-11-06 14:41:31 peter
|
Revision 1.30 2000-02-01 12:53:23 peter
|
||||||
|
* fixed rangecheck error in format()
|
||||||
|
|
||||||
|
Revision 1.29 1999/11/06 14:41:31 peter
|
||||||
* truncated log
|
* truncated log
|
||||||
|
|
||||||
Revision 1.28 1999/10/12 19:16:27 florian
|
Revision 1.28 1999/10/12 19:16:27 florian
|
||||||
|
Loading…
Reference in New Issue
Block a user