From 1f22735c592059955ebc6731a08620b0d9c6fa32 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 17 Feb 2024 15:45:03 -0800 Subject: [PATCH] remove static_cast from lambda Just specify the return type. Signed-off-by: Rosen Penev --- src/EbmlElement.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/EbmlElement.cpp b/src/EbmlElement.cpp index 471b979c..b05ea67b 100644 --- a/src/EbmlElement.cpp +++ b/src/EbmlElement.cpp @@ -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(nullptr); - return static_cast(new EbmlDummy(PossibleID)); + return nullptr; + return new EbmlDummy(pID); } if (SizeFound != SizeUnknown && MaxDataSize < SizeFound) - return static_cast(nullptr); + return nullptr; // check if the size is not all 1s if (SizeFound == SizeUnknown && !ClassInfos.CanHaveInfiniteSize()) - return static_cast(nullptr); + return nullptr; return &EBML_INFO_CREATE(ClassInfos); }(); - if (Result == nullptr) + if (!Result) return nullptr; if (!Result->SizeIsValid(SizeFound)) {