From 51c88e7c7c95d4ff104f1ae760b1a1a13139c9b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Wed, 13 Mar 2019 22:01:05 +0100 Subject: [PATCH] Do not require GPSAltitudeRef (assume positive if missing) --- src/data/exifparser.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data/exifparser.cpp b/src/data/exifparser.cpp index 334d9008..cdda1bfe 100644 --- a/src/data/exifparser.cpp +++ b/src/data/exifparser.cpp @@ -54,8 +54,7 @@ QDate EXIFParser::date(TIFFFile &file, const IFDEntry &ds) const double EXIFParser::altitude(TIFFFile &file, const IFDEntry &alt, const IFDEntry &altRef) const { - if (!(alt.type == TIFF_RATIONAL && alt.count == 1 - && altRef.type == TIFF_BYTE && altRef.count == 1)) + if (!(alt.type == TIFF_RATIONAL && alt.count == 1)) return NAN; if (!file.seek(alt.offset)) @@ -67,7 +66,8 @@ double EXIFParser::altitude(TIFFFile &file, const IFDEntry &alt, if (!file.readValue(den)) return NAN; - return altRef.offset ? -num/(double)den : num/(double)den; + return (altRef.type == TIFF_BYTE && altRef.count == 1 && altRef.offset) + ? -num/(double)den : num/(double)den; } double EXIFParser::coordinate(TIFFFile &file, const IFDEntry &ll) const