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

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

Loading…
Cancel
Save