Skip to content

Commit

Permalink
early exit
Browse files Browse the repository at this point in the history
less indentation

Signed-off-by: Rosen Penev <rosenp@gmail.com>
  • Loading branch information
neheb committed Nov 21, 2022
1 parent cf15cc5 commit 67df851
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
14 changes: 4 additions & 10 deletions src/tags_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2328,7 +2328,6 @@ bool isMakerIfd(IfdId ifdId) {
}

bool isExifIfd(IfdId ifdId) {
bool rc;
switch (ifdId) {
case IfdId::ifd0Id:
case IfdId::exifId:
Expand All @@ -2349,13 +2348,10 @@ bool isExifIfd(IfdId ifdId) {
case IfdId::subImage9Id:
case IfdId::subThumb1Id:
case IfdId::panaRawId:
rc = true;
break;
return true;
default:
rc = false;
break;
return false;
}
return rc;
}

void taglist(std::ostream& os, IfdId ifdId) {
Expand Down Expand Up @@ -2554,11 +2550,9 @@ std::ostream& printUcs2(std::ostream& os, const Value& value, const ExifData*) {

// Strip trailing UCS-2 0-characters
while (buf.size() >= 2) {
if (buf.read_uint8(buf.size() - 1) == 0 && buf.read_uint8(buf.size() - 2) == 0) {
buf.resize(buf.size() - 2);
} else {
if (buf.read_uint8(buf.size() - 1) != 0 || buf.read_uint8(buf.size() - 2) != 0)
break;
}
buf.resize(buf.size() - 2);
}

std::string str(buf.c_str(), buf.size());
Expand Down
8 changes: 3 additions & 5 deletions src/xmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,12 +495,10 @@ void XmpData::eraseFamily(XmpData::iterator& pos) {
std::string key(pos->key());
std::vector<std::string> keys;
while (pos != xmpMetadata_.end()) {
if (Exiv2::Internal::startsWith(pos->key(), key)) {
keys.push_back(pos->key());
pos++;
} else {
if (!Exiv2::Internal::startsWith(pos->key(), key))
break;
}
keys.push_back(pos->key());
pos++;
}
// now erase the family!
for (const auto& k : keys) {
Expand Down

0 comments on commit 67df851

Please sign in to comment.