remove some pointless std::set

Partially found by gcc's -fanalyzer

Signed-off-by: Rosen Penev <rosenp@gmail.com>
main
Rosen Penev 4 years ago committed by Luis Díaz Más
parent 4c4f8da338
commit d1e116a8ef

@ -1183,18 +1183,12 @@ namespace Exiv2 {
}
int sony2010eSelector(uint16_t /*tag*/, const byte* /*pData*/, uint32_t /*size*/, TiffComponent* const pRoot)
{
const char* models[] = { "SLT-A58", "SLT-A99", "ILCE-3000", "ILCE-3500", "NEX-3N", "NEX-5R", "NEX-5T", "NEX-6", "VG30E", "VG900",
"DSC-RX100", "DSC-RX1", "DSC-RX1R", "DSC-HX300", "DSC-HX50V", "DSC-TX30", "DSC-WX60", "DSC-WX200", "DSC-WX300" };
std::set<std::string> s2010eModels;
for (auto&& model : models) {
s2010eModels.insert(model);
}
std::string model = getExifModel(pRoot);
int idx = -1;
if (s2010eModels.find(model) != s2010eModels.end()) {
idx = 0;
}
return idx;
static constexpr const char* models[] = {
"SLT-A58", "SLT-A99", "ILCE-3000", "ILCE-3500", "NEX-3N", "NEX-5R", "NEX-5T",
"NEX-6", "VG30E", "VG900", "DSC-RX100", "DSC-RX1", "DSC-RX1R", "DSC-HX300",
"DSC-HX50V", "DSC-TX30", "DSC-WX60", "DSC-WX200", "DSC-WX300",
};
return std::find(std::begin(models), std::end(models), getExifModel(pRoot)) != std::end(models) ? 0 : -1;
}
} // namespace Internal
} // namespace Exiv2

@ -2163,12 +2163,13 @@ namespace Exiv2 {
std::string maxAperture = getKeyString("Exif.Photo.MaxApertureValue" ,metadata);
std::string F1_8 = "434/256" ;
std::set<std::string> maxApertures;
maxApertures.insert( "926/256") ; // F3.5
maxApertures.insert("1024/256") ; // F4
maxApertures.insert("1110/256") ; // F4.5
maxApertures.insert("1188/256") ; // F5
maxApertures.insert("1272/256") ; // F5.6
static constexpr const char* maxApertures[] = {
"926/256", // F3.5
"1024/256", // F4
"1110/256", // F4.5
"1188/256", // F5
"1272/256", // F5.6
};
if ( model == "ILCE-6000" && maxAperture == F1_8 ) try {
long focalLength = getKeyLong ("Exif.Photo.FocalLength" ,metadata);
@ -2177,12 +2178,16 @@ namespace Exiv2 {
if ( inRange(focalRatio,145,155) ) index = 2 ;
} catch (...) {}
if ( model == "ILCE-6000" && maxApertures.find(maxAperture) != maxApertures.end() ) try {
if (model == "ILCE-6000" &&
std::find(std::begin(maxApertures), std::end(maxApertures), maxAperture) != std::end(maxApertures))
try {
long focalLength = getKeyLong("Exif.Photo.FocalLength", metadata);
long focalL35mm = getKeyLong("Exif.Photo.FocalLengthIn35mmFilm", metadata);
long focalRatio = (focalL35mm * 100) / focalLength;
if ( inRange(focalRatio,145,155) ) index = 3 ;
} catch (...) {}
if (inRange(focalRatio, 145, 155))
index = 3;
} catch (...) {
}
if ( index > 0 ) {
const long lensID = 0xffff;

Loading…
Cancel
Save