Skip to content

Commit

Permalink
remove some pointless std::set
Browse files Browse the repository at this point in the history
Partially found by gcc's -fanalyzer

Signed-off-by: Rosen Penev <rosenp@gmail.com>
  • Loading branch information
neheb authored and piponazo committed May 25, 2021
1 parent 4c4f8da commit d1e116a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
18 changes: 6 additions & 12 deletions src/makernote_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 17 additions & 12 deletions src/minoltamn_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -2177,12 +2178,16 @@ namespace Exiv2 {
if ( inRange(focalRatio,145,155) ) index = 2 ;
} catch (...) {}

if ( model == "ILCE-6000" && maxApertures.find(maxAperture) != maxApertures.end() ) 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 (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 ( index > 0 ) {
const long lensID = 0xffff;
Expand Down

0 comments on commit d1e116a

Please sign in to comment.