mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-07 03:26:23 +02:00
* Cleanup variant->string conversions: TryStrToDate and TryStrToTime are redundant because TryStrToDateTime already does the same checks. Patch from Luiz Americo, resolves #19115.
git-svn-id: trunk@17265 -
This commit is contained in:
parent
6fb666135f
commit
b7a56722ff
@ -833,25 +833,19 @@ var
|
|||||||
begin
|
begin
|
||||||
s := WideString(p);
|
s := WideString(p);
|
||||||
|
|
||||||
if not (TryStrToDateTime(s, Result) or
|
if not TryStrToDateTime(s, Result) then
|
||||||
TryStrToDate(s, Result) or
|
|
||||||
TryStrToTime(s, Result)) then
|
|
||||||
VariantTypeMismatch(varOleStr, varDate);
|
VariantTypeMismatch(varOleStr, varDate);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function LStrToDate(p: Pointer) : TDateTime;
|
Function LStrToDate(p: Pointer) : TDateTime;
|
||||||
begin
|
begin
|
||||||
if not (TryStrToDateTime(AnsiString(p), Result) or
|
if not TryStrToDateTime(AnsiString(p), Result) then
|
||||||
TryStrToDate(AnsiString(p), Result) or
|
|
||||||
TryStrToTime(AnsiString(p), Result)) then
|
|
||||||
VariantTypeMismatch(varString, varDate);
|
VariantTypeMismatch(varString, varDate);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function UStrToDate(p: Pointer) : TDateTime;
|
Function UStrToDate(p: Pointer) : TDateTime;
|
||||||
begin
|
begin
|
||||||
if not (TryStrToDateTime(UnicodeString(p), Result) or
|
if not TryStrToDateTime(UnicodeString(p), Result) then
|
||||||
TryStrToDate(UnicodeString(p), Result) or
|
|
||||||
TryStrToTime(UnicodeString(p), Result)) then
|
|
||||||
VariantTypeMismatch(varUString, varDate);
|
VariantTypeMismatch(varUString, varDate);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user