Skip to content

Commit 67df851

Browse files
committed
early exit
less indentation Signed-off-by: Rosen Penev <[email protected]>
1 parent cf15cc5 commit 67df851

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

src/tags_int.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,7 +2328,6 @@ bool isMakerIfd(IfdId ifdId) {
23282328
}
23292329

23302330
bool isExifIfd(IfdId ifdId) {
2331-
bool rc;
23322331
switch (ifdId) {
23332332
case IfdId::ifd0Id:
23342333
case IfdId::exifId:
@@ -2349,13 +2348,10 @@ bool isExifIfd(IfdId ifdId) {
23492348
case IfdId::subImage9Id:
23502349
case IfdId::subThumb1Id:
23512350
case IfdId::panaRawId:
2352-
rc = true;
2353-
break;
2351+
return true;
23542352
default:
2355-
rc = false;
2356-
break;
2353+
return false;
23572354
}
2358-
return rc;
23592355
}
23602356

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

25552551
// Strip trailing UCS-2 0-characters
25562552
while (buf.size() >= 2) {
2557-
if (buf.read_uint8(buf.size() - 1) == 0 && buf.read_uint8(buf.size() - 2) == 0) {
2558-
buf.resize(buf.size() - 2);
2559-
} else {
2553+
if (buf.read_uint8(buf.size() - 1) != 0 || buf.read_uint8(buf.size() - 2) != 0)
25602554
break;
2561-
}
2555+
buf.resize(buf.size() - 2);
25622556
}
25632557

25642558
std::string str(buf.c_str(), buf.size());

src/xmp.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -495,12 +495,10 @@ void XmpData::eraseFamily(XmpData::iterator& pos) {
495495
std::string key(pos->key());
496496
std::vector<std::string> keys;
497497
while (pos != xmpMetadata_.end()) {
498-
if (Exiv2::Internal::startsWith(pos->key(), key)) {
499-
keys.push_back(pos->key());
500-
pos++;
501-
} else {
498+
if (!Exiv2::Internal::startsWith(pos->key(), key))
502499
break;
503-
}
500+
keys.push_back(pos->key());
501+
pos++;
504502
}
505503
// now erase the family!
506504
for (const auto& k : keys) {

0 commit comments

Comments
 (0)