simplify boolean expressions (#1130)

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2023-09-06 12:16:59 -07:00 committed by GitHub
parent 54f84cc924
commit 912897cd35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -231,7 +231,7 @@ MP4::Tag::parseBool(const MP4::Atom *atom)
{
ByteVectorList data = parseData(atom);
if(!data.isEmpty()) {
bool value = data[0].size() ? data[0][0] != '\0' : false;
bool value = !data[0].isEmpty() && data[0][0] != '\0';
addItem(atom->name, value);
}
}

View File

@ -309,7 +309,7 @@ List<Ogg::Page *> Ogg::Page::paginate(const ByteVectorList &packets,
streamSerialNumber,
pageIndex,
continued,
lastSplit && (lastPacketInList ? lastPacketCompleted : true),
lastSplit && (!lastPacketInList || lastPacketCompleted),
lastSplit && (containsLastPacket && lastPacketInList)));
pageIndex++;
continued = true;

View File

@ -63,9 +63,9 @@ PropertyMap Tag::properties() const
map["COMMENT"].append(comment());
if(!(genre().isEmpty()))
map["GENRE"].append(genre());
if(!(year() == 0))
if(year() != 0)
map["DATE"].append(String::number(year()));
if(!(track() == 0))
if(track() != 0)
map["TRACKNUMBER"].append(String::number(track()));
return map;
}