mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-23 16:49:37 +01:00
* Fix problem with IE for inlined taking address (@S[1]) of empty const
git-svn-id: trunk@27781 -
This commit is contained in:
parent
7de12fb703
commit
81a95f6f1b
@ -512,39 +512,42 @@ function StrToDate(const S: string; FormatSettings: TFormatSettings): TDateTime;
|
|||||||
var
|
var
|
||||||
Msg: AnsiString;
|
Msg: AnsiString;
|
||||||
begin
|
begin
|
||||||
Result:=IntStrToDate(Msg,@S[1],Length(S),FormatSettings.ShortDateFormat,FormatSettings);
|
Result:=IntStrToDate(Msg,PChar(S),Length(S),FormatSettings.ShortDateFormat,FormatSettings);
|
||||||
if Msg<>'' then
|
if Msg<>'' then
|
||||||
raise EConvertError.Create(Msg);
|
raise EConvertError.Create(Msg);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function StrToDate(const S: ShortString; const useformat : string; separator : char = #0): TDateTime;
|
function StrToDate(const S: ShortString; const useformat : string; separator : char = #0): TDateTime;
|
||||||
begin
|
begin
|
||||||
result := StrToDate(@S[1],Length(s),UseFormat,separator);
|
// S[1] always exists for shortstring. Length 0 will trigger an error.
|
||||||
|
result := StrToDate(@S[1],Length(s),UseFormat,separator);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function StrToDate(const S: AnsiString; const useformat : string; separator : char = #0): TDateTime;
|
function StrToDate(const S: AnsiString; const useformat : string; separator : char = #0): TDateTime;
|
||||||
begin
|
begin
|
||||||
result := StrToDate(@S[1],Length(s),UseFormat,separator);
|
result := StrToDate(PChar(S),Length(s),UseFormat,separator);
|
||||||
end;
|
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),DefaultFormatSettings.ShortDateFormat,separator)
|
// S[1] always exists for shortstring. Length 0 will trigger an error.
|
||||||
|
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),DefaultFormatSettings.ShortDateFormat,#0);
|
// S[1] always exists for shortstring. Length 0 will trigger an error.
|
||||||
|
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),DefaultFormatSettings.ShortDateFormat,separator)
|
result := StrToDate(Pchar(S),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),DefaultFormatSettings.ShortDateFormat,#0);
|
result := StrToDate(Pchar(S),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
|
||||||
@ -731,29 +734,31 @@ function StrToTime(const S: string; FormatSettings : TFormatSettings): TDateTime
|
|||||||
Var
|
Var
|
||||||
Msg : AnsiString;
|
Msg : AnsiString;
|
||||||
begin
|
begin
|
||||||
Result:=IntStrToTime(Msg, @S[1], length(S), FormatSettings, #0);
|
Result:=IntStrToTime(Msg, PChar(S), length(S), FormatSettings, #0);
|
||||||
If (Msg<>'') then
|
If (Msg<>'') then
|
||||||
Raise EConvertError.Create(Msg);
|
Raise EConvertError.Create(Msg);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function StrToTime(const s: ShortString; separator : char): TDateTime;
|
function StrToTime(const s: ShortString; separator : char): TDateTime;
|
||||||
begin
|
begin
|
||||||
result := StrToTime(@s[1], length(s), separator);
|
// S[1] always exists for shortstring. Length 0 will trigger an error.
|
||||||
|
result := StrToTime(@s[1], length(s), separator);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function StrToTime(const s: AnsiString; separator : char): TDateTime;
|
function StrToTime(const s: AnsiString; separator : char): TDateTime;
|
||||||
begin
|
begin
|
||||||
result := StrToTime(@s[1], length(s), separator);
|
result := StrToTime(PChar(S), length(s), separator);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function StrToTime(const s: ShortString): TDateTime;
|
function StrToTime(const s: ShortString): TDateTime;
|
||||||
begin
|
begin
|
||||||
|
// S[1] always exists for shortstring. Length 0 will trigger an error.
|
||||||
result := StrToTime(@s[1], length(s), #0);
|
result := StrToTime(@s[1], length(s), #0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function StrToTime(const s: AnsiString): TDateTime;
|
function StrToTime(const s: AnsiString): TDateTime;
|
||||||
begin
|
begin
|
||||||
result := StrToTime(@s[1], length(s), #0);
|
result:= StrToTime(PChar(s), length(s), #0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ StrToDateTime converts the string S to a TDateTime value
|
{ StrToDateTime converts the string S to a TDateTime value
|
||||||
@ -1257,6 +1262,7 @@ Var
|
|||||||
Msg : Ansistring;
|
Msg : Ansistring;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
// S[1] always exists for shortstring. Length 0 will trigger an error.
|
||||||
Value:=IntStrToDate(Msg,@S[1],Length(S),useformat,defaultformatsettings,separator);
|
Value:=IntStrToDate(Msg,@S[1],Length(S),useformat,defaultformatsettings,separator);
|
||||||
Result:=(Msg='');
|
Result:=(Msg='');
|
||||||
end;
|
end;
|
||||||
@ -1271,7 +1277,7 @@ begin
|
|||||||
Result:=Length(S)<>0;
|
Result:=Length(S)<>0;
|
||||||
If Result then
|
If Result then
|
||||||
begin
|
begin
|
||||||
Value:=IntStrToDate(Msg,@S[1],Length(S),useformat,DefaultFormatSettings,Separator);
|
Value:=IntStrToDate(Msg,PChar(S),Length(S),useformat,DefaultFormatSettings,Separator);
|
||||||
Result:=(Msg='');
|
Result:=(Msg='');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1301,7 +1307,7 @@ begin
|
|||||||
Result:=Length(S)<>0;
|
Result:=Length(S)<>0;
|
||||||
If Result then
|
If Result then
|
||||||
begin
|
begin
|
||||||
Value:=IntStrToDate(Msg,@S[1],Length(S),FormatSettings.ShortDateFormat,FormatSettings,#0);
|
Value:=IntStrToDate(Msg,PChar(S),Length(S),FormatSettings.ShortDateFormat,FormatSettings,#0);
|
||||||
Result:=(Msg='');
|
Result:=(Msg='');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1311,6 +1317,7 @@ function TryStrToTime(const S: ShortString; out Value: TDateTime; separator : ch
|
|||||||
Var
|
Var
|
||||||
Msg : AnsiString;
|
Msg : AnsiString;
|
||||||
begin
|
begin
|
||||||
|
// S[1] always exists for shortstring. Length 0 will trigger an error.
|
||||||
Value:=IntStrToTime(Msg,@S[1],Length(S),DefaultFormatSettings,Separator);
|
Value:=IntStrToTime(Msg,@S[1],Length(S),DefaultFormatSettings,Separator);
|
||||||
result:=(Msg='');
|
result:=(Msg='');
|
||||||
end;
|
end;
|
||||||
@ -1327,7 +1334,7 @@ begin
|
|||||||
Result:=Length(S)<>0;
|
Result:=Length(S)<>0;
|
||||||
If Result then
|
If Result then
|
||||||
begin
|
begin
|
||||||
Value:=IntStrToTime(Msg,@S[1],Length(S),DefaultFormatSettings,Separator);
|
Value:=IntStrToTime(Msg,PChar(S),Length(S),DefaultFormatSettings,Separator);
|
||||||
Result:=(Msg='');
|
Result:=(Msg='');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1343,7 +1350,7 @@ begin
|
|||||||
Result:=Length(S)<>0;
|
Result:=Length(S)<>0;
|
||||||
If Result then
|
If Result then
|
||||||
begin
|
begin
|
||||||
Value:=IntStrToTime(Msg,@S[1],Length(S),FormatSettings,#0);
|
Value:=IntStrToTime(Msg,PChar(S),Length(S),FormatSettings,#0);
|
||||||
Result:=(Msg='');
|
Result:=(Msg='');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user