mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-28 08:09:16 +02:00
lcl: workaround fpc bug in the StrToFloatDef function (fixes issue #0013293)
git-svn-id: trunk@18942 -
This commit is contained in:
parent
39c69e59f7
commit
cd635adfcb
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user