* 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:
sergei 2011-01-09 15:27:05 +00:00
parent f06a903427
commit 131b7fcdb2
5 changed files with 21 additions and 24 deletions

View File

@ -420,8 +420,8 @@ var
begin begin
j := 1; j := 1;
for i := 1 to Length(s) do for i := 1 to Length(s) do
if s[i] <> ThousandSeparator then begin if s[i] <> DefaultFormatSettings.ThousandSeparator then begin
if s[i] = DecimalSeparator then if s[i] = DefaultFormatSettings.DecimalSeparator then
s[j] := '.' s[j] := '.'
else else
s[j] := s[i]; s[j] := s[i];

View File

@ -1972,12 +1972,12 @@ Var
begin begin
DecodeDateTime(ABasedate,Y,M,D,H,N,S,MS); DecodeDateTime(ABasedate,Y,M,D,H,N,S,MS);
Msg:=DoField(AYear,Y,'????'); Msg:=DoField(AYear,Y,'????');
Msg:=Msg+DateSeparator+DoField(AMonth,M,'??'); Msg:=Msg+DefaultFormatSettings.DateSeparator+DoField(AMonth,M,'??');
Msg:=Msg+DateSeparator+DoField(ADay,D,'??'); Msg:=Msg+DefaultFormatSettings.DateSeparator+DoField(ADay,D,'??');
Msg:=Msg+' '+DoField(AHour,H,'??'); Msg:=Msg+' '+DoField(AHour,H,'??');
Msg:=Msg+TimeSeparator+DoField(AMinute,N,'??'); Msg:=Msg+DefaultFormatSettings.TimeSeparator+DoField(AMinute,N,'??');
Msg:=Msg+TimeSeparator+Dofield(ASecond,S,'??'); Msg:=Msg+DefaultFormatSettings.TimeSeparator+Dofield(ASecond,S,'??');
Msg:=Msg+DecimalSeparator+DoField(AMilliSecond,MS,'???'); Msg:=Msg+DefaultFormatSettings.DecimalSeparator+DoField(AMilliSecond,MS,'???');
Raise EConvertError.CreateFmt(SErrInvalidTimeStamp,[Msg]); Raise EConvertError.CreateFmt(SErrInvalidTimeStamp,[Msg]);
end; end;

View File

@ -1217,8 +1217,8 @@ IMPLEMENTATION
end; end;
{ find out language-specific ? } { find out language-specific ? }
DecimalPoint_is_System: begin DecimalPoint_is_System: begin
dp := DecimalSeparator; dp := DefaultFormatSettings.DecimalSeparator;
dc := ThousandSeparator; dc := DefaultFormatSettings.ThousandSeparator;
end; end;
end; end;
end; end;

View File

@ -511,22 +511,22 @@ end;
function StrToDate(const S: ShortString; separator : char): TDateTime; function StrToDate(const S: ShortString; separator : char): TDateTime;
begin begin
result := StrToDate(@S[1],Length(s),ShortDateFormat,separator) result := StrToDate(@S[1],Length(s),DefaultFormatSettings.ShortDateFormat,separator)
end; end;
function StrToDate(const S: ShortString): TDateTime; function StrToDate(const S: ShortString): TDateTime;
begin begin
result := StrToDate(@S[1],Length(s),ShortDateFormat,#0); result := StrToDate(@S[1],Length(s),DefaultFormatSettings.ShortDateFormat,#0);
end; end;
function StrToDate(const S: AnsiString; separator : char): TDateTime; function StrToDate(const S: AnsiString; separator : char): TDateTime;
begin begin
result := StrToDate(@S[1],Length(s),ShortDateFormat,separator) result := StrToDate(@S[1],Length(s),DefaultFormatSettings.ShortDateFormat,separator)
end; end;
function StrToDate(const S: AnsiString): TDateTime; function StrToDate(const S: AnsiString): TDateTime;
begin begin
result := StrToDate(@S[1],Length(s),ShortDateFormat,#0); result := StrToDate(@S[1],Length(s),DefaultFormatSettings.ShortDateFormat,#0);
end; end;
{ StrToTime converts the string S to a TDateTime value { StrToTime converts the string S to a TDateTime value
@ -737,7 +737,7 @@ function StrToDateTime(const s: string): TDateTime;
var var
I: integer; I: integer;
begin begin
I:=Pos(TimeSeparator,S); I:=Pos(DefaultFormatSettings.TimeSeparator,S);
If (I>0) then If (I>0) then
begin begin
While (I>0) and (S[I]<>' ') do While (I>0) and (S[I]<>' ') do
@ -755,7 +755,7 @@ function StrToDateTime(const s: AnsiString; const UseFormat : TFormatSettings):
var var
I: integer; I: integer;
begin begin
I:=Pos(TimeSeparator,S); I:=Pos(UseFormat.TimeSeparator,S);
If (I>0) then If (I>0) then
begin begin
While (I>0) and (S[I]<>' ') do While (I>0) and (S[I]<>' ') do
@ -774,7 +774,7 @@ function StrToDateTime(const s: ShortString; const UseFormat : TFormatSettings):
var var
I: integer; I: integer;
begin begin
I:=Pos(TimeSeparator,S); I:=Pos(UseFormat.TimeSeparator,S);
If (I>0) then If (I>0) then
begin begin
While (I>0) and (S[I]<>' ') do While (I>0) and (S[I]<>' ') do
@ -1197,19 +1197,19 @@ end;
function TryStrToDate(const S: ShortString; out Value: TDateTime; separator : char): Boolean; function TryStrToDate(const S: ShortString; out Value: TDateTime; separator : char): Boolean;
begin begin
Result:=TryStrToDate(S,Value,ShortDateFormat,Separator); Result:=TryStrToDate(S,Value,DefaultFormatSettings.ShortDateFormat,Separator);
end; end;
function TryStrToDate(const S: AnsiString; out Value: TDateTime): Boolean; function TryStrToDate(const S: AnsiString; out Value: TDateTime): Boolean;
begin begin
Result:=TryStrToDate(S,Value,ShortDateFormat,#0); Result:=TryStrToDate(S,Value,DefaultFormatSettings.ShortDateFormat,#0);
end; end;
function TryStrToDate(const S: AnsiString; out Value: TDateTime; separator : char): Boolean; function TryStrToDate(const S: AnsiString; out Value: TDateTime; separator : char): Boolean;
begin begin
Result:=TryStrToDate(S,Value,ShortDateFormat,Separator); Result:=TryStrToDate(S,Value,DefaultFormatSettings.ShortDateFormat,Separator);
end; end;
function TryStrToDate(const S: string; out Value: TDateTime; const FormatSettings: TFormatSettings): Boolean; function TryStrToDate(const S: string; out Value: TDateTime; const FormatSettings: TFormatSettings): Boolean;

View File

@ -1170,9 +1170,7 @@ Var
// removes negative sign in case when result is zero eg. -0.00 // removes negative sign in case when result is zero eg. -0.00
var var
i: PtrInt; i: PtrInt;
S: String;
TS: Char; TS: Char;
B: Boolean;
StartPos: PtrInt; StartPos: PtrInt;
begin begin
Result := False; Result := False;
@ -1181,7 +1179,6 @@ Var
else else
StartPos := 2; StartPos := 2;
TS := FormatSettings.ThousandSeparator; TS := FormatSettings.ThousandSeparator;
S := '';
for i := StartPos to length(AValue) do for i := StartPos to length(AValue) do
begin begin
Result := (AValue[i] in ['0', DS, 'E', '+', TS]); Result := (AValue[i] in ['0', DS, 'E', '+', TS]);
@ -1432,7 +1429,7 @@ Begin
End End
Else Else
Begin Begin
Case NegCurrFormat Of Case FormatSettings.NegCurrFormat Of
0: Result := '(' + FormatSettings.CurrencyString + Result + ')'; 0: Result := '(' + FormatSettings.CurrencyString + Result + ')';
1: Result := '-' + FormatSettings.CurrencyString + Result; 1: Result := '-' + FormatSettings.CurrencyString + Result;
2: 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 while (Length(s) > n) and (s[n] = ' ') do
inc(n); inc(n);
while (Length(s) >= n) and 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 begin
s1 := s1+s[n]; s1 := s1+s[n];
inc(n); inc(n);