I have attached minor "rearangement", consider them please
Will do. It's possible to go even further and completely exclude
finalization and try..finally block, because the intermediate Variant
is always of type Double, which doesn't need finalization.
See please attached patch if is it
L.
--- f:\tmp\fmtbcd.pp.old Tue Apr 12 14:01:52 2011
+++ f:\tmp\fmtbcd.pp Tue Apr 12 14:07:56 2011
@@ -4004,18 +4004,13 @@ var v: TVarData;
begin
if Source.vType=VarType then
begin
- VarDataInit(v);
- try
- if aVarType = varString then
- VarDataFromStr(Dest, BCDToStr(TFMTBcdVarData(Source.vPointer).BCD))
- else
- begin
- v.vType:=varDouble;
- v.vDouble:=BCDToDouble(TFMTBcdVarData(Source.vPointer).BCD);
- VarDataCastTo(Dest, v, aVarType); //now cast Double to any requested
type
- end;
- finally
- VarDataClear(v);
+ if aVarType = varString then
+ VarDataFromStr(Dest, BCDToStr(TFMTBcdVarData(Source.vPointer).BCD))
+ else
+ begin
+ v.vType:=varDouble;
+ v.vDouble:=BCDToDouble(TFMTBcdVarData(Source.vPointer).BCD);
+ VarDataCastTo(Dest, v, aVarType); //now cast Double to any requested type
end;
end
else
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel