mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 09:26:15 +02:00
* pass format string to doformaterror procedure. Mantis 16253
git-svn-id: trunk@17080 -
This commit is contained in:
parent
7b8c319e3e
commit
7c1f4b8f20
@ -28,7 +28,7 @@ Var ChPos,OldPos,ArgPos,DoArg,Len : SizeInt;
|
|||||||
While (ChPos<=Len) and
|
While (ChPos<=Len) and
|
||||||
(Fmt[ChPos]<='9') and (Fmt[ChPos]>='0') do inc(ChPos);
|
(Fmt[ChPos]<='9') and (Fmt[ChPos]>='0') do inc(ChPos);
|
||||||
If ChPos>len then
|
If ChPos>len then
|
||||||
DoFormatError(feInvalidFormat);
|
DoFormatError(feInvalidFormat,Fmt);
|
||||||
If Fmt[ChPos]='*' then
|
If Fmt[ChPos]='*' then
|
||||||
begin
|
begin
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ Var ChPos,OldPos,ArgPos,DoArg,Len : SizeInt;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
If (ChPos>OldPos) or (ArgN>High(Args)) then
|
If (ChPos>OldPos) or (ArgN>High(Args)) then
|
||||||
DoFormatError(feInvalidFormat);
|
DoFormatError(feInvalidFormat,Fmt);
|
||||||
|
|
||||||
ArgPos:=ArgN+1;
|
ArgPos:=ArgN+1;
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ Var ChPos,OldPos,ArgPos,DoArg,Len : SizeInt;
|
|||||||
vtInt64: Value := Args[ArgN].VInt64^;
|
vtInt64: Value := Args[ArgN].VInt64^;
|
||||||
vtQWord: Value := Args[ArgN].VQWord^;
|
vtQWord: Value := Args[ArgN].VQWord^;
|
||||||
else
|
else
|
||||||
DoFormatError(feInvalidFormat);
|
DoFormatError(feInvalidFormat,Fmt);
|
||||||
end;
|
end;
|
||||||
Inc(ChPos);
|
Inc(ChPos);
|
||||||
end
|
end
|
||||||
@ -60,7 +60,7 @@ Var ChPos,OldPos,ArgPos,DoArg,Len : SizeInt;
|
|||||||
begin
|
begin
|
||||||
Val (Copy(Fmt,OldPos,ChPos-OldPos),value,code);
|
Val (Copy(Fmt,OldPos,ChPos-OldPos),value,code);
|
||||||
// This should never happen !!
|
// This should never happen !!
|
||||||
If Code>0 then DoFormatError (feInvalidFormat);
|
If Code>0 then DoFormatError (feInvalidFormat,Fmt);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Value:=-1;
|
Value:=-1;
|
||||||
@ -76,7 +76,7 @@ Var ChPos,OldPos,ArgPos,DoArg,Len : SizeInt;
|
|||||||
value:=0; // Delphi undocumented behaviour, assume 0, #11099
|
value:=0; // Delphi undocumented behaviour, assume 0, #11099
|
||||||
If Fmt[ChPos]=':' then
|
If Fmt[ChPos]=':' then
|
||||||
begin
|
begin
|
||||||
If Value=-1 then DoFormatError(feMissingArgument);
|
If Value=-1 then DoFormatError(feMissingArgument,fmt);
|
||||||
Index:=Value;
|
Index:=Value;
|
||||||
Value:=-1;
|
Value:=-1;
|
||||||
Inc(ChPos);
|
Inc(ChPos);
|
||||||
@ -202,7 +202,7 @@ begin
|
|||||||
If (Doarg>High(Args)) or (Args[Doarg].Vtype<>AT) then
|
If (Doarg>High(Args)) or (Args[Doarg].Vtype<>AT) then
|
||||||
begin
|
begin
|
||||||
if err then
|
if err then
|
||||||
DoFormatError(feInvalidArgindex);
|
DoFormatError(feInvalidArgindex,Fmt);
|
||||||
dec(ArgPos);
|
dec(ArgPos);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
@ -896,12 +896,12 @@ end;
|
|||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
|
|
||||||
Procedure DoFormatError (ErrCode : Longint);
|
Procedure DoFormatError (ErrCode : Longint;const fmt:ansistring);
|
||||||
Var
|
Var
|
||||||
S : String;
|
S : String;
|
||||||
begin
|
begin
|
||||||
//!! must be changed to contain format string...
|
//!! must be changed to contain format string...
|
||||||
S:='';
|
S:=fmt;
|
||||||
Case ErrCode of
|
Case ErrCode of
|
||||||
feInvalidFormat : raise EConvertError.Createfmt(SInvalidFormat,[s]);
|
feInvalidFormat : raise EConvertError.Createfmt(SInvalidFormat,[s]);
|
||||||
feMissingArgument : raise EConvertError.Createfmt(SArgumentMissing,[s]);
|
feMissingArgument : raise EConvertError.Createfmt(SArgumentMissing,[s]);
|
||||||
@ -909,7 +909,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ we've no templates, but with includes we can simulate this :) }
|
{ we've no templates, but with includes we can simulate this :) }
|
||||||
|
|
||||||
{$macro on}
|
{$macro on}
|
||||||
|
Loading…
Reference in New Issue
Block a user