diff --git a/src/crwimage_int.cpp b/src/crwimage_int.cpp index 9b724030..26051244 100644 --- a/src/crwimage_int.cpp +++ b/src/crwimage_int.cpp @@ -550,18 +550,16 @@ CiffComponent* CiffDirectory::doAdd(CrwDirs& crwDirs, uint16_t crwTagId) { set value */ if (!crwDirs.empty()) { - auto [dir, parent] = crwDirs.top(); + auto dir = crwDirs.top(); crwDirs.pop(); // Find the directory - for (auto&& component : components_) { - if (component->tag() == dir) { - cc_ = component; - break; - } - } + auto it = + std::find_if(components_.begin(), components_.end(), [=](const auto& c) { return c->tag() == dir.first; }); + if (it != components_.end()) + cc_ = *it; if (!cc_) { // Directory doesn't exist yet, add it - m_ = std::make_unique(dir, parent); + m_ = std::make_unique(dir.first, dir.second); cc_ = m_.get(); add(std::move(m_)); } @@ -569,12 +567,10 @@ CiffComponent* CiffDirectory::doAdd(CrwDirs& crwDirs, uint16_t crwTagId) { cc_ = cc_->add(crwDirs, crwTagId); } else { // Find the tag - for (auto&& component : components_) { - if (component->tagId() == crwTagId) { - cc_ = component; - break; - } - } + auto it = + std::find_if(components_.begin(), components_.end(), [=](const auto& c) { return c->tagId() == crwTagId; }); + if (it != components_.end()) + cc_ = *it; if (!cc_) { // Tag doesn't exist yet, add it m_ = std::make_unique(crwTagId, tag()); @@ -604,27 +600,23 @@ void CiffComponent::doRemove(CrwDirs& /*crwDirs*/, uint16_t /*crwTagId*/) { void CiffDirectory::doRemove(CrwDirs& crwDirs, uint16_t crwTagId) { if (!crwDirs.empty()) { - auto [dir, _] = crwDirs.top(); + auto dir = crwDirs.top(); crwDirs.pop(); // Find the directory - for (auto i = components_.begin(); i != components_.end(); ++i) { - if ((*i)->tag() == dir) { - // Recursive call to next lower level directory - (*i)->remove(crwDirs, crwTagId); - if ((*i)->empty()) - components_.erase(i); - break; - } + auto it = + std::find_if(components_.begin(), components_.end(), [=](const auto& c) { return c->tag() == dir.first; }); + if (it != components_.end()) { + // Recursive call to next lower level directory + (*it)->remove(crwDirs, crwTagId); + if ((*it)->empty()) + components_.erase(it); } } else { // Find the tag - for (auto i = components_.begin(); i != components_.end(); ++i) { - if ((*i)->tagId() == crwTagId) { - // Remove the entry and abort the loop - delete *i; - components_.erase(i); - break; - } + auto it = std::find_if(components_.begin(), components_.end(), [=](const auto& c) { return c->tag() == crwTagId; }); + if (it != components_.end()) { + delete *it; + components_.erase(it); } } } // CiffDirectory::doRemove diff --git a/src/makernote_int.cpp b/src/makernote_int.cpp index 23b9feb5..7e39c11c 100644 --- a/src/makernote_int.cpp +++ b/src/makernote_int.cpp @@ -889,7 +889,7 @@ int nikonSelector(uint16_t tag, const byte* pData, size_t size, TiffComponent* / return -1; auto ix = NikonArrayIdx::Key(tag, reinterpret_cast(pData), size); - auto it = std::find_if(nikonArrayIdx.begin(), nikonArrayIdx.end(), [ix](auto&& aix) { return aix == ix; }); + auto it = std::find(nikonArrayIdx.begin(), nikonArrayIdx.end(), ix); if (it == nikonArrayIdx.end()) return -1; diff --git a/src/sonymn_int.cpp b/src/sonymn_int.cpp index 56e28d62..6c3c0ac8 100644 --- a/src/sonymn_int.cpp +++ b/src/sonymn_int.cpp @@ -871,7 +871,7 @@ std::ostream& SonyMakerNote::printSonyMisc3cShotNumberSincePowerUp(std::ostream& "DSC-RX100M4", "DSC-RX100M5", "DSC-WX220", "DSC-WX350", "DSC-WX500", }; - bool f = std::any_of(models.begin(), models.end(), [model = pos->toString()](auto&& m) { return m == model; }); + bool f = std::find(models.begin(), models.end(), pos->toString()) != models.end(); if (f) return os << value.toInt64(); return os << N_("n/a"); @@ -938,7 +938,7 @@ std::ostream& SonyMakerNote::printSonyMisc3cSonyImageHeight(std::ostream& os, co // Models that do not support this tag const auto models = std::array{"ILCE-1", "ILCE-7SM3", "ILME-FX3"}; - bool f = std::any_of(models.begin(), models.end(), [model = pos->toString()](auto&& m) { return m == model; }); + bool f = std::find(models.begin(), models.end(), pos->toString()) != models.end(); if (f) return os << N_("n/a"); @@ -957,7 +957,7 @@ std::ostream& SonyMakerNote::printSonyMisc3cModelReleaseYear(std::ostream& os, c // Models that do not support this tag const auto models = std::array{"ILCE-1", "ILCE-7SM3", "ILME-FX3"}; - bool f = std::any_of(models.begin(), models.end(), [model = pos->toString()](auto&& m) { return m == model; }); + bool f = std::find(models.begin(), models.end(), pos->toString()) != models.end(); if (f) return os << N_("n/a");