Fix double promotion in target rtexif

This commit is contained in:
Ingo Weyrich 2020-01-20 16:02:30 +01:00
parent 6d76670e7d
commit 544a2e5068
6 changed files with 11 additions and 11 deletions

View File

@ -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<double>(powf (2.f, static_cast<float>(a) / 32.f - 4.f)) * 50.0 + 0.5;
return i;
} else {
return 0;

View File

@ -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);

View File

@ -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<double>(powf(2.f, float (a) / 12.f - 5.f)) * 100.0 + 0.5;
return i;
} else {
return 0;

View File

@ -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<float>(10 * (a >> 2)) * std::pow(4.f, static_cast<float>((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<float>(10 * (a >> 2)) * std::pow(4.f, static_cast<float>((a & 0x03) - 2));
if (b > 1.f) {
if (b > 1.0) {
return b;
} else {
return 0.;

View File

@ -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;
}

View File

@ -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;
}