fpExif: Fix floating point overflow in the ShutterSpeed tag in case of manual exposure (https://forum.lazarus.freepascal.org/index.php/topic,49648.msg382611.html).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7837 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-11-02 09:39:32 +00:00
parent 5c9302493f
commit a2291fa2e7
2 changed files with 12 additions and 3 deletions

View File

@ -1510,8 +1510,10 @@ var
p: Integer;
begin
floatVal := GetAsFloat;
if IsNaN(floatVal) or (floatVal = 0) then
if IsNaN(floatVal) then
Result := ''
else if floatVal = 0 then
Result := '(manual)'
else
if FFormatStr = '' then begin
if floatVal >= 10 then
@ -1585,8 +1587,13 @@ var
begin
Result := inherited GetRational(AIndex, r);
if Result then begin
dbl := r.Numerator / r.Denominator;
AValue := FloatToRational(Power(2.0, -dbl), 1E-9);
if (r.Numerator = LongInt($80000000)) then // fix for https://forum.lazarus.freepascal.org/index.php/topic,49648.msg382611.html
AValue := RATIONAL_ZERO
else
begin
dbl := r.Numerator / r.Denominator;
AValue := FloatToRational(Power(2.0, -dbl), 1E-9);
end;
end;
end;

View File

@ -129,6 +129,8 @@ const
IPTC_MULTI_TAG_COUNT = $FFFF;
IPTC_MULTI_TAG_SEPARATOR = #1;
RATIONAL_ZERO: TExifRational = (Numerator:0; Denominator:1);
var
fpExifDataSep : ansistring = ', ';
fpExifDecodeSep : string = ',';