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