Skip to content

Commit

Permalink
some
Browse files Browse the repository at this point in the history
Signed-off-by: Rosen Penev <rosenp@gmail.com>
  • Loading branch information
neheb committed Jan 2, 2025
1 parent d0ea148 commit 209a724
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/tags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,16 @@ bool GroupInfo::operator==(const GroupName& groupName) const {
}

const char* ExifTags::sectionName(const ExifKey& key) {
const TagInfo* ti = tagInfo(key.tag(), key.ifdId());
if (!ti)
return sectionInfo[static_cast<int>(unknownTag.sectionId_)].name_;
return sectionInfo[static_cast<int>(ti->sectionId_)].name_;
if (auto ti = tagInfo(key.tag(), key.ifdId()))
return sectionInfo[static_cast<int>(ti->sectionId_)].name_;
return sectionInfo[static_cast<int>(unknownTag.sectionId_)].name_;
}

/// \todo not used internally. At least we should test it
uint16_t ExifTags::defaultCount(const ExifKey& key) {
const TagInfo* ti = tagInfo(key.tag(), key.ifdId());
if (!ti)
return unknownTag.count_;
return ti->count_;
if (auto ti = tagInfo(key.tag(), key.ifdId()))
return ti->count_;
return unknownTag.count_;
}

const char* ExifTags::ifdName(const std::string& groupName) {
Expand Down Expand Up @@ -240,12 +238,11 @@ ExifKey::ExifKey(uint16_t tag, const std::string& groupName) : p_(std::make_uniq
if (!Internal::isExifIfd(ifdId) && !Internal::isMakerIfd(ifdId)) {
throw Error(ErrorCode::kerInvalidIfdId, ifdId);
}
const TagInfo* ti = tagInfo(tag, ifdId);
if (!ti) {
throw Error(ErrorCode::kerInvalidIfdId, ifdId);
if (auto ti = tagInfo(tag, ifdId)) {
p_->groupName_ = groupName;
p_->makeKey(tag, ifdId, ti);
}
p_->groupName_ = groupName;
p_->makeKey(tag, ifdId, ti);
throw Error(ErrorCode::kerInvalidIfdId, ifdId);
}

ExifKey::ExifKey(const TagInfo& ti) : p_(std::make_unique<Impl>()) {
Expand Down

0 comments on commit 209a724

Please sign in to comment.