Skip to content

Commit

Permalink
remove static_cast from lambda
Browse files Browse the repository at this point in the history
Just specify the return type.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
  • Loading branch information
neheb committed Feb 25, 2024
1 parent 2f5ecf8 commit 1f22735
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/EbmlElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,23 +195,22 @@ EbmlElement * EbmlElement::FindNextID(IOCallback & DataStream, const EbmlCallbac
} while (_SizeLength == 0);
}

const auto PossibleID = EbmlId(EbmlId::FromBuffer(PossibleId.data(), PossibleID_Length));
auto Result = [&] {
if (PossibleID != EBML_INFO_ID(ClassInfos))
{
auto Result = [&]() -> EbmlElement * {
auto pID = EbmlId(EbmlId::FromBuffer(PossibleId.data(), PossibleID_Length));
if (pID != EBML_INFO_ID(ClassInfos)) {
if (SizeFound == SizeUnknown)
return static_cast<EbmlElement *>(nullptr);
return static_cast<EbmlElement *>(new EbmlDummy(PossibleID));
return nullptr;
return new EbmlDummy(pID);
}
if (SizeFound != SizeUnknown && MaxDataSize < SizeFound)
return static_cast<EbmlElement *>(nullptr);
return nullptr;
// check if the size is not all 1s
if (SizeFound == SizeUnknown && !ClassInfos.CanHaveInfiniteSize())
return static_cast<EbmlElement *>(nullptr);
return nullptr;
return &EBML_INFO_CREATE(ClassInfos);
}();

if (Result == nullptr)
if (!Result)
return nullptr;

if (!Result->SizeIsValid(SizeFound)) {
Expand Down

0 comments on commit 1f22735

Please sign in to comment.