find_if conversion
Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
9766c4532d
commit
932d59a984
@ -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<CiffDirectory>(dir, parent);
|
||||
m_ = std::make_unique<CiffDirectory>(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<CiffEntry>(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
|
||||
|
||||
@ -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<const char*>(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;
|
||||
|
||||
|
||||
@ -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");
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user