summaryrefslogtreecommitdiff
path: root/rtl/objpas/sysutils
diff options
context:
space:
mode:
Diffstat (limited to 'rtl/objpas/sysutils')
-rw-r--r--rtl/objpas/sysutils/dati.inc13
-rw-r--r--rtl/objpas/sysutils/sysformt.inc12
-rw-r--r--rtl/objpas/sysutils/sysstr.inc5
-rw-r--r--rtl/objpas/sysutils/sysutilh.inc2
4 files changed, 15 insertions, 17 deletions
diff --git a/rtl/objpas/sysutils/dati.inc b/rtl/objpas/sysutils/dati.inc
index 3723fc5fa2..db580cf03d 100644
--- a/rtl/objpas/sysutils/dati.inc
+++ b/rtl/objpas/sysutils/dati.inc
@@ -358,7 +358,7 @@ var
c:word;
dp,mp,yp,which : Byte;
s1:string[4];
- values:array[1..3] of longint;
+ values:array[0..3] of longint;
LocalTime:tsystemtime;
YearMoreThenTwoDigits : boolean;
begin
@@ -402,12 +402,6 @@ begin
end;
end;
end;
- if Which<>3 then
- begin
- FixErrorMsg(SErrIllegalDateFormatString,useformat);
- Exit;
- end;
-{ Get actual values }
for i := 1 to 3 do
values[i] := 0;
s1 := '';
@@ -448,6 +442,11 @@ begin
Exit;
end;
end ;
+ if (Which<3) and (N>Which) then
+ begin
+ FixErrorMsg(SInvalidDateFormat,s);
+ Exit;
+ end;
// Fill in values.
getLocalTime(LocalTime);
ly := LocalTime.Year;
diff --git a/rtl/objpas/sysutils/sysformt.inc b/rtl/objpas/sysutils/sysformt.inc
index ae953acc15..defd2d5314 100644
--- a/rtl/objpas/sysutils/sysformt.inc
+++ b/rtl/objpas/sysutils/sysformt.inc
@@ -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;
diff --git a/rtl/objpas/sysutils/sysstr.inc b/rtl/objpas/sysutils/sysstr.inc
index 9fbd76ebc2..0cccd3add4 100644
--- a/rtl/objpas/sysutils/sysstr.inc
+++ b/rtl/objpas/sysutils/sysstr.inc
@@ -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}
diff --git a/rtl/objpas/sysutils/sysutilh.inc b/rtl/objpas/sysutils/sysutilh.inc
index 6ad58f2204..a3ccbf6078 100644
--- a/rtl/objpas/sysutils/sysutilh.inc
+++ b/rtl/objpas/sysutils/sysutilh.inc
@@ -197,7 +197,7 @@ type
ESafecallException = class(Exception);
ENoThreadSupport = Class(Exception);
ENoWideStringSupport = Class(Exception);
-
+ ENotImplemented = class(Exception);
{ Exception handling routines }
function ExceptObject: TObject;