Skip to content

Commit

Permalink
Refactoring suggested by @neheb
Browse files Browse the repository at this point in the history
(cherry picked from commit 03bdced)

# Conflicts:
#	src/crwimage_int.cpp
  • Loading branch information
kevinbackhouse authored and mergify[bot] committed Jan 31, 2025
1 parent d6aceaf commit 16e1d8b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/crwimage_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ CiffComponent* CiffDirectory::doAdd(CrwDirs& crwDirs, uint16_t crwTagId) {
add(std::move(m_));
}
// Recursive call to next lower level directory
<<<<<<< HEAD
cc = cc->add(crwDirs, crwTagId);
} else {
// Find the tag
Expand All @@ -587,7 +588,22 @@ CiffComponent* CiffDirectory::doAdd(CrwDirs& crwDirs, uint16_t crwTagId) {
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;
>>>>>>> 03bdced4 (Refactoring suggested by @neheb)
}
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 16e1d8b

Please sign in to comment.