A variant which stored string convert to DateTime failure in FPC 2.0.0
Original Reporter info from Mantis: FPCCore
-
Reporter name: FPC core team
Original Reporter info from Mantis: FPCCore
- Reporter name: FPC core team
Description:
A variant which stored string convert to DateTime failure in FPC 2.0.0.
See a program source.
I am trace into the source(2.0.0 release), in the rtl\objpas\cvarutil.inc I found, the
function implementation of VariantToDate is incomplete, lost the string(and widestring) convert to result case:
Function VariantToDate(Const VargSrc : TVarData) : TDateTime;
begin
Try
With VargSrc do
Case (VType and VarTypeMask) of
VarSmallInt: Result:=FloatToDateTime(VSmallInt);
VarShortInt: Result:=FloatToDateTime(VShortInt);
VarInteger : Result:=FloatToDateTime(VInteger);
VarSingle : Result:=FloatToDateTime(VSingle);
VarDouble : Result:=FloatToDateTime(VDouble);
VarCurrency: Result:=FloatToDateTime(VCurrency);
VarDate : Result:=VDate;
VarOleStr : NoWideStrings; //<<==== here
//varString: <<======= leak a varString
VarBoolean : Result:=FloatToDateTime(Longint(VBoolean));
VarByte : Result:=FloatToDateTime(VByte);
VarWord : Result:=FloatToDateTime(VWord);
VarLongWord : Result:=FloatToDateTime(VLongWord);
VarInt64 : Result:=FloatToDateTime(VInt64);
VarQWord : Result:=FloatToDateTime(VQword);
else
VariantTypeMismatch;
end;
except
On EConvertError do
VariantTypeMismatch;
else
Raise;
end;
end;
and other function also has this problem
Additional information:
Reporter: alphax
EMail: acmui_2004 at 163 dot com
Mantis conversion info:
- Mantis ID: 6040
- OS: Win32