From 131b7fcdb21c9c92cec6fece925740e3ad5ede01 Mon Sep 17 00:00:00 2001 From: sergei Date: Sun, 9 Jan 2011 15:27:05 +0000 Subject: [PATCH] * RTL: Replaced deprecated formatting symbols with their up-to-date counterparts, reduces compiler noise. * Also removed some unused variables. git-svn-id: trunk@16744 - --- rtl/objpas/cvarutil.inc | 4 ++-- rtl/objpas/dateutil.inc | 10 +++++----- rtl/objpas/fmtbcd.pp | 4 ++-- rtl/objpas/sysutils/dati.inc | 20 ++++++++++---------- rtl/objpas/sysutils/sysstr.inc | 7 ++----- 5 files changed, 21 insertions(+), 24 deletions(-) diff --git a/rtl/objpas/cvarutil.inc b/rtl/objpas/cvarutil.inc index 64d9652905..acb4df178c 100644 --- a/rtl/objpas/cvarutil.inc +++ b/rtl/objpas/cvarutil.inc @@ -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]; diff --git a/rtl/objpas/dateutil.inc b/rtl/objpas/dateutil.inc index 925f8b2982..22a3003f2e 100644 --- a/rtl/objpas/dateutil.inc +++ b/rtl/objpas/dateutil.inc @@ -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; diff --git a/rtl/objpas/fmtbcd.pp b/rtl/objpas/fmtbcd.pp index df2c5ab745..7dcdf2196a 100644 --- a/rtl/objpas/fmtbcd.pp +++ b/rtl/objpas/fmtbcd.pp @@ -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; diff --git a/rtl/objpas/sysutils/dati.inc b/rtl/objpas/sysutils/dati.inc index 5ed76d166f..3723fc5fa2 100644 --- a/rtl/objpas/sysutils/dati.inc +++ b/rtl/objpas/sysutils/dati.inc @@ -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; diff --git a/rtl/objpas/sysutils/sysstr.inc b/rtl/objpas/sysutils/sysstr.inc index ffbc77c930..9fbd76ebc2 100644 --- a/rtl/objpas/sysutils/sysstr.inc +++ b/rtl/objpas/sysutils/sysstr.inc @@ -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);