Skip to content

Commit

Permalink
Refactoring suggested by @neheb
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinbackhouse authored and neheb committed Jan 31, 2025
1 parent b2fdeca commit 03bdced
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/crwimage_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,20 +557,20 @@ CiffComponent* CiffDirectory::doAdd(CrwDirs& crwDirs, uint16_t crwTagId) {
add(std::move(m_));
}
// Recursive call to next lower level directory
cc = cc->add(crwDirs, crwTagId);
} else {
// Find the tag
for (const auto& c : components_)
if (c->tagId() == crwTagId) {
cc = c;
break;
}
if (!cc) {
// Tag doesn't exist yet, add it
m_ = std::make_unique<CiffEntry>(crwTagId, tag());
cc = m_.get();
add(std::move(m_));
return cc->add(crwDirs, crwTagId);
}

// Find the tag
for (const auto& c : components_)
if (c->tagId() == crwTagId) {
cc = c;
break;
}
if (!cc) {
// Tag doesn't exist yet, add it
m_ = std::make_unique<CiffEntry>(crwTagId, tag());
cc = m_.get();
add(std::move(m_));
}
return cc;
} // CiffDirectory::doAdd
Expand Down

0 comments on commit 03bdced

Please sign in to comment.