early exit

less indentation

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2022-10-31 17:25:32 -07:00
parent cf15cc52e0
commit 67df85135d
2 changed files with 7 additions and 15 deletions

View File

@ -2328,7 +2328,6 @@ bool isMakerIfd(IfdId ifdId) {
} }
bool isExifIfd(IfdId ifdId) { bool isExifIfd(IfdId ifdId) {
bool rc;
switch (ifdId) { switch (ifdId) {
case IfdId::ifd0Id: case IfdId::ifd0Id:
case IfdId::exifId: case IfdId::exifId:
@ -2349,13 +2348,10 @@ bool isExifIfd(IfdId ifdId) {
case IfdId::subImage9Id: case IfdId::subImage9Id:
case IfdId::subThumb1Id: case IfdId::subThumb1Id:
case IfdId::panaRawId: case IfdId::panaRawId:
rc = true; return true;
break;
default: default:
rc = false; return false;
break;
} }
return rc;
} }
void taglist(std::ostream& os, IfdId ifdId) { void taglist(std::ostream& os, IfdId ifdId) {
@ -2554,11 +2550,9 @@ std::ostream& printUcs2(std::ostream& os, const Value& value, const ExifData*) {
// Strip trailing UCS-2 0-characters // Strip trailing UCS-2 0-characters
while (buf.size() >= 2) { while (buf.size() >= 2) {
if (buf.read_uint8(buf.size() - 1) == 0 && buf.read_uint8(buf.size() - 2) == 0) { if (buf.read_uint8(buf.size() - 1) != 0 || buf.read_uint8(buf.size() - 2) != 0)
buf.resize(buf.size() - 2);
} else {
break; break;
} buf.resize(buf.size() - 2);
} }
std::string str(buf.c_str(), buf.size()); std::string str(buf.c_str(), buf.size());

View File

@ -495,12 +495,10 @@ void XmpData::eraseFamily(XmpData::iterator& pos) {
std::string key(pos->key()); std::string key(pos->key());
std::vector<std::string> keys; std::vector<std::string> keys;
while (pos != xmpMetadata_.end()) { while (pos != xmpMetadata_.end()) {
if (Exiv2::Internal::startsWith(pos->key(), key)) { if (!Exiv2::Internal::startsWith(pos->key(), key))
keys.push_back(pos->key());
pos++;
} else {
break; break;
} keys.push_back(pos->key());
pos++;
} }
// now erase the family! // now erase the family!
for (const auto& k : keys) { for (const auto& k : keys) {