mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-21 19:05:16 +02:00
* RTL: Replaced deprecated formatting symbols with their up-to-date counterparts, reduces compiler noise.
* Also removed some unused variables. git-svn-id: trunk@16744 -
This commit is contained in:
parent
f06a903427
commit
131b7fcdb2
@ -420,8 +420,8 @@ var
|
||||
begin
|
||||
j := 1;
|
||||
for i := 1 to Length(s) do
|
||||
if s[i] <> ThousandSeparator then begin
|
||||
if s[i] = DecimalSeparator then
|
||||
if s[i] <> DefaultFormatSettings.ThousandSeparator then begin
|
||||
if s[i] = DefaultFormatSettings.DecimalSeparator then
|
||||
s[j] := '.'
|
||||
else
|
||||
s[j] := s[i];
|
||||
|
@ -1972,12 +1972,12 @@ Var
|
||||
begin
|
||||
DecodeDateTime(ABasedate,Y,M,D,H,N,S,MS);
|
||||
Msg:=DoField(AYear,Y,'????');
|
||||
Msg:=Msg+DateSeparator+DoField(AMonth,M,'??');
|
||||
Msg:=Msg+DateSeparator+DoField(ADay,D,'??');
|
||||
Msg:=Msg+DefaultFormatSettings.DateSeparator+DoField(AMonth,M,'??');
|
||||
Msg:=Msg+DefaultFormatSettings.DateSeparator+DoField(ADay,D,'??');
|
||||
Msg:=Msg+' '+DoField(AHour,H,'??');
|
||||
Msg:=Msg+TimeSeparator+DoField(AMinute,N,'??');
|
||||
Msg:=Msg+TimeSeparator+Dofield(ASecond,S,'??');
|
||||
Msg:=Msg+DecimalSeparator+DoField(AMilliSecond,MS,'???');
|
||||
Msg:=Msg+DefaultFormatSettings.TimeSeparator+DoField(AMinute,N,'??');
|
||||
Msg:=Msg+DefaultFormatSettings.TimeSeparator+Dofield(ASecond,S,'??');
|
||||
Msg:=Msg+DefaultFormatSettings.DecimalSeparator+DoField(AMilliSecond,MS,'???');
|
||||
Raise EConvertError.CreateFmt(SErrInvalidTimeStamp,[Msg]);
|
||||
end;
|
||||
|
||||
|
@ -1217,8 +1217,8 @@ IMPLEMENTATION
|
||||
end;
|
||||
{ find out language-specific ? }
|
||||
DecimalPoint_is_System: begin
|
||||
dp := DecimalSeparator;
|
||||
dc := ThousandSeparator;
|
||||
dp := DefaultFormatSettings.DecimalSeparator;
|
||||
dc := DefaultFormatSettings.ThousandSeparator;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -511,22 +511,22 @@ end;
|
||||
|
||||
function StrToDate(const S: ShortString; separator : char): TDateTime;
|
||||
begin
|
||||
result := StrToDate(@S[1],Length(s),ShortDateFormat,separator)
|
||||
result := StrToDate(@S[1],Length(s),DefaultFormatSettings.ShortDateFormat,separator)
|
||||
end;
|
||||
|
||||
function StrToDate(const S: ShortString): TDateTime;
|
||||
begin
|
||||
result := StrToDate(@S[1],Length(s),ShortDateFormat,#0);
|
||||
result := StrToDate(@S[1],Length(s),DefaultFormatSettings.ShortDateFormat,#0);
|
||||
end;
|
||||
|
||||
function StrToDate(const S: AnsiString; separator : char): TDateTime;
|
||||
begin
|
||||
result := StrToDate(@S[1],Length(s),ShortDateFormat,separator)
|
||||
result := StrToDate(@S[1],Length(s),DefaultFormatSettings.ShortDateFormat,separator)
|
||||
end;
|
||||
|
||||
function StrToDate(const S: AnsiString): TDateTime;
|
||||
begin
|
||||
result := StrToDate(@S[1],Length(s),ShortDateFormat,#0);
|
||||
result := StrToDate(@S[1],Length(s),DefaultFormatSettings.ShortDateFormat,#0);
|
||||
end;
|
||||
|
||||
{ StrToTime converts the string S to a TDateTime value
|
||||
@ -737,7 +737,7 @@ function StrToDateTime(const s: string): TDateTime;
|
||||
var
|
||||
I: integer;
|
||||
begin
|
||||
I:=Pos(TimeSeparator,S);
|
||||
I:=Pos(DefaultFormatSettings.TimeSeparator,S);
|
||||
If (I>0) then
|
||||
begin
|
||||
While (I>0) and (S[I]<>' ') do
|
||||
@ -755,7 +755,7 @@ function StrToDateTime(const s: AnsiString; const UseFormat : TFormatSettings):
|
||||
var
|
||||
I: integer;
|
||||
begin
|
||||
I:=Pos(TimeSeparator,S);
|
||||
I:=Pos(UseFormat.TimeSeparator,S);
|
||||
If (I>0) then
|
||||
begin
|
||||
While (I>0) and (S[I]<>' ') do
|
||||
@ -774,7 +774,7 @@ function StrToDateTime(const s: ShortString; const UseFormat : TFormatSettings):
|
||||
var
|
||||
I: integer;
|
||||
begin
|
||||
I:=Pos(TimeSeparator,S);
|
||||
I:=Pos(UseFormat.TimeSeparator,S);
|
||||
If (I>0) then
|
||||
begin
|
||||
While (I>0) and (S[I]<>' ') do
|
||||
@ -1197,19 +1197,19 @@ end;
|
||||
|
||||
function TryStrToDate(const S: ShortString; out Value: TDateTime; separator : char): Boolean;
|
||||
begin
|
||||
Result:=TryStrToDate(S,Value,ShortDateFormat,Separator);
|
||||
Result:=TryStrToDate(S,Value,DefaultFormatSettings.ShortDateFormat,Separator);
|
||||
end;
|
||||
|
||||
|
||||
function TryStrToDate(const S: AnsiString; out Value: TDateTime): Boolean;
|
||||
begin
|
||||
Result:=TryStrToDate(S,Value,ShortDateFormat,#0);
|
||||
Result:=TryStrToDate(S,Value,DefaultFormatSettings.ShortDateFormat,#0);
|
||||
end;
|
||||
|
||||
function TryStrToDate(const S: AnsiString; out Value: TDateTime; separator : char): Boolean;
|
||||
|
||||
begin
|
||||
Result:=TryStrToDate(S,Value,ShortDateFormat,Separator);
|
||||
Result:=TryStrToDate(S,Value,DefaultFormatSettings.ShortDateFormat,Separator);
|
||||
end;
|
||||
|
||||
function TryStrToDate(const S: string; out Value: TDateTime; const FormatSettings: TFormatSettings): Boolean;
|
||||
|
@ -1170,9 +1170,7 @@ Var
|
||||
// removes negative sign in case when result is zero eg. -0.00
|
||||
var
|
||||
i: PtrInt;
|
||||
S: String;
|
||||
TS: Char;
|
||||
B: Boolean;
|
||||
StartPos: PtrInt;
|
||||
begin
|
||||
Result := False;
|
||||
@ -1181,7 +1179,6 @@ Var
|
||||
else
|
||||
StartPos := 2;
|
||||
TS := FormatSettings.ThousandSeparator;
|
||||
S := '';
|
||||
for i := StartPos to length(AValue) do
|
||||
begin
|
||||
Result := (AValue[i] in ['0', DS, 'E', '+', TS]);
|
||||
@ -1432,7 +1429,7 @@ Begin
|
||||
End
|
||||
Else
|
||||
Begin
|
||||
Case NegCurrFormat Of
|
||||
Case FormatSettings.NegCurrFormat Of
|
||||
0: Result := '(' + FormatSettings.CurrencyString + Result + ')';
|
||||
1: Result := '-' + FormatSettings.CurrencyString + Result;
|
||||
2: Result := FormatSettings.CurrencyString + '-' + Result;
|
||||
@ -2901,7 +2898,7 @@ function sscanf(const s: string; const fmt : string;const Pointers : array of Po
|
||||
while (Length(s) > n) and (s[n] = ' ') do
|
||||
inc(n);
|
||||
while (Length(s) >= n) and
|
||||
(s[n] in ['0'..'9', '+', '-', DecimalSeparator, 'e', 'E']) do
|
||||
(s[n] in ['0'..'9', '+', '-', FormatSettings.DecimalSeparator, 'e', 'E']) do
|
||||
begin
|
||||
s1 := s1+s[n];
|
||||
inc(n);
|
||||
|
Loading…
Reference in New Issue
Block a user