lcl: workaround fpc bug in the StrToFloatDef function (fixes issue #0013293)

git-svn-id: trunk@18942 -
This commit is contained in:
paul 2009-03-10 09:49:44 +00:00
parent 39c69e59f7
commit cd635adfcb

View File

@ -186,9 +186,23 @@ begin
end;
function TCustomFloatSpinEdit.StrToValue(const S: String): Double;
// this is a workaround for the fpc rtl bug in StrToFloatDef function
// which happens when DecimalSeparator = ThousandSeparator
// (look at issue 0013293)
function MyStrToFloatDef(S: String; Def: Double): Double;
var
V: Extended;
begin
if TextToFloat(PChar(S), V) then
Result := V
else
Result := Def;
end;
begin
try
Result := GetLimitedValue(StrToFloatDef(S, FValue));
Result := GetLimitedValue(MyStrToFloatDef(S, FValue));
except
Result := FValue;
end;