From 544a2e5068e38fa4f57c56159c53ddd0e1d6b38c Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Mon, 20 Jan 2020 16:02:30 +0100 Subject: [PATCH] Fix double promotion in target rtexif --- rtexif/canonattribs.cc | 2 +- rtexif/kodakattribs.cc | 6 +++--- rtexif/nikonattribs.cc | 2 +- rtexif/pentaxattribs.cc | 8 ++++---- rtexif/rtexif.cc | 2 +- rtexif/sonyminoltaattribs.cc | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/rtexif/canonattribs.cc b/rtexif/canonattribs.cc index 0e6f7eb2f..5d907e242 100644 --- a/rtexif/canonattribs.cc +++ b/rtexif/canonattribs.cc @@ -1174,7 +1174,7 @@ public: int a = Interpreter::toInt (t, ofs, astype); if (a > 1) { - int i = int (double (powf (2.f, float (a) / 32.f - 4.f)) * 50.f + 0.5f); + int i = static_cast(powf (2.f, static_cast(a) / 32.f - 4.f)) * 50.0 + 0.5; return i; } else { return 0; diff --git a/rtexif/kodakattribs.cc b/rtexif/kodakattribs.cc index a9c168a70..9c7d7d1ee 100644 --- a/rtexif/kodakattribs.cc +++ b/rtexif/kodakattribs.cc @@ -58,7 +58,7 @@ void parseKodakIfdTextualInfo (Tag *textualInfo, Tag* exif_) // Proback645 may have "Lens" but not "Focal Length" float flen = atof (val.c_str()); - if (flen != 0.0) { + if (flen != 0.f) { t = new Tag (exif, lookupAttrib (exifAttribs, "FocalLength")); t->initRational (flen * 32, 32); exif->replaceTag (t); @@ -66,7 +66,7 @@ void parseKodakIfdTextualInfo (Tag *textualInfo, Tag* exif_) } else if (key == "Focal Length") { float flen = atof (val.c_str()); - if (flen != 0.0) { + if (flen != 0.f) { t = new Tag (exif, lookupAttrib (exifAttribs, "FocalLength")); t->initRational (flen * 32, 32); exif->replaceTag (t); @@ -74,7 +74,7 @@ void parseKodakIfdTextualInfo (Tag *textualInfo, Tag* exif_) } else if (key == "Aperture") { float aperture = atof (&val.c_str()[1]); - if (aperture != 0.0) { + if (aperture != 0.f) { t = new Tag (exif, lookupAttrib (exifAttribs, "FNumber")); t->initRational ((int) (aperture * 10), 10); exif->replaceTag (t); diff --git a/rtexif/nikonattribs.cc b/rtexif/nikonattribs.cc index 77720dde0..b050b3b87 100644 --- a/rtexif/nikonattribs.cc +++ b/rtexif/nikonattribs.cc @@ -70,7 +70,7 @@ public: int a = t->getValue()[ofs]; if (a > 1) { - int i = int (double (powf (2.f, float (a) / 12.f - 5.f)) * 100.f + 0.5f); + int i = static_cast(powf(2.f, float (a) / 12.f - 5.f)) * 100.0 + 0.5; return i; } else { return 0; diff --git a/rtexif/pentaxattribs.cc b/rtexif/pentaxattribs.cc index 898150696..89e5172e8 100644 --- a/rtexif/pentaxattribs.cc +++ b/rtexif/pentaxattribs.cc @@ -1391,9 +1391,9 @@ public: std::string toString (const Tag* t) const override { int a = t->toInt (0, BYTE); - float b = float (10 * int (a >> 2)) * pow (4.f, float (int (a & 0x03) - 2)); + double b = static_cast(10 * (a >> 2)) * std::pow(4.f, static_cast((a & 0x03) - 2)); - if (b > 1.f) { + if (b > 1.0) { char buffer[32]; sprintf (buffer, "%.2f", b ); return buffer; @@ -1404,9 +1404,9 @@ public: double toDouble (const Tag* t, int ofs) override { int a = t->toInt (ofs, BYTE); - float b = float (10 * int (a >> 2)) * pow (4.f, float (int (a & 0x03) - 2)); + double b = static_cast(10 * (a >> 2)) * std::pow(4.f, static_cast((a & 0x03) - 2)); - if (b > 1.f) { + if (b > 1.0) { return b; } else { return 0.; diff --git a/rtexif/rtexif.cc b/rtexif/rtexif.cc index 89ff6cd33..06604ade5 100644 --- a/rtexif/rtexif.cc +++ b/rtexif/rtexif.cc @@ -2344,7 +2344,7 @@ void ExifManager::parseCIFF (int length, TagDirectory* root) ev = ((short)get2 (f, INTEL)) / 32.0f; fseek (f, 34, SEEK_CUR); - if (shutter > 1e6) { + if (shutter > 1e6f) { shutter = get2 (f, INTEL) / 10.0f; } diff --git a/rtexif/sonyminoltaattribs.cc b/rtexif/sonyminoltaattribs.cc index 4410a4051..11130a577 100644 --- a/rtexif/sonyminoltaattribs.cc +++ b/rtexif/sonyminoltaattribs.cc @@ -2252,7 +2252,7 @@ public: // Decode the value if (a && a != 254) { // 254 = 'Auto' for CameraSettings3, but we might say the same for CameraSettings & CameraSettings2 (?) - return int (expf ((double (a) / 8.f - 6.f) * logf (2.f)) * 100.f + 0.5f); + return std::exp((a / 8.f - 6.f) * std::log(2.f)) * 100.f + 0.5f; } else { return 0; }