Fix two coverity issues
This commit is contained in:
@@ -2191,7 +2191,7 @@ bool Thumbnail::readEmbProfile (const Glib::ustring& fname)
|
|||||||
|
|
||||||
if (!fseek (f, 0, SEEK_SET)) {
|
if (!fseek (f, 0, SEEK_SET)) {
|
||||||
embProfileData = new unsigned char[embProfileLength];
|
embProfileData = new unsigned char[embProfileLength];
|
||||||
fread (embProfileData, 1, embProfileLength, f);
|
embProfileLength = fread (embProfileData, 1, embProfileLength, f);
|
||||||
embProfile = cmsOpenProfileFromMem (embProfileData, embProfileLength);
|
embProfile = cmsOpenProfileFromMem (embProfileData, embProfileLength);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -104,12 +104,11 @@ void parseKodakIfdTextualInfo (Tag *textualInfo, Tag* exif_)
|
|||||||
a = atoi (val.c_str());
|
a = atoi (val.c_str());
|
||||||
b = atoi (&p1[1]);
|
b = atoi (&p1[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
t = new Tag (exif, lookupAttrib (exifAttribs, "ExposureTime"));
|
t = new Tag (exif, lookupAttrib (exifAttribs, "ExposureTime"));
|
||||||
t->initRational (a, b);
|
t->initRational (a, b);
|
||||||
exif->replaceTag (t);
|
exif->replaceTag (t);
|
||||||
|
|
||||||
float ssv = -log2 ((float)a / (float)b); // convert to APEX value
|
const float ssv = -log2 ((float)a / std::max((float)b, 0.0001f)); // convert to APEX value, avoid division by zero
|
||||||
t = new Tag (exif, lookupAttrib (exifAttribs, "ShutterSpeedValue"));
|
t = new Tag (exif, lookupAttrib (exifAttribs, "ShutterSpeedValue"));
|
||||||
t->initRational (1000000 * ssv, 1000000);
|
t->initRational (1000000 * ssv, 1000000);
|
||||||
exif->replaceTag (t);
|
exif->replaceTag (t);
|
||||||
|
Reference in New Issue
Block a user