From ac630fdc73c62427820ce2a835ea7642f1d961bc Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Fri, 1 Mar 2024 15:13:53 +0100 Subject: [PATCH] use Child helpers in test00 --- test/ebml/test00.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/ebml/test00.cpp b/test/ebml/test00.cpp index 04ba7a45..0a1e81f4 100644 --- a/test/ebml/test00.cpp +++ b/test/ebml/test00.cpp @@ -59,21 +59,21 @@ int main(void) // size is unknown and will always be, we can render it right away FirstSegment.Render(Ebml_file); - KaxAttachments * pAllAttachments = static_cast(FirstSegment.FindFirstElt(EBML_INFO(KaxAttachments), true)); + KaxAttachments * pAllAttachments = &GetChild(FirstSegment); if (pAllAttachments == NULL) return -1; pAllAttachments->SetSizeInfinite(); // size is unknown and will always be, we can render it right away pAllAttachments->Render(Ebml_file); - KaxAttached * pAttachment1 = static_cast(pAllAttachments->FindFirstElt(EBML_INFO(KaxAttached), true)); + KaxAttached * pAttachment1 = &GetChild(*pAllAttachments); if (pAttachment1 == NULL) return -1; - KaxFileName * pFileName1 = static_cast(pAttachment1->FindFirstElt(EBML_INFO(KaxFileName), true)); + KaxFileName * pFileName1 = &GetChild(*pAttachment1); if (pFileName1 == NULL) return -1; pFileName1->SetValue(UTFstring{L"file1.txt"}); - KaxFileData * pFileData1 = static_cast(pAttachment1->FindFirstElt(EBML_INFO(KaxFileData), true)); + KaxFileData * pFileData1 = &GetChild(*pAttachment1); if (pFileData1 == NULL) return -1; char Buffer1[] = "Ah ah ah !"; @@ -81,15 +81,15 @@ int main(void) // should produce an error if the size is not infinite and the data has been rendered pAttachment1->Render(Ebml_file); - KaxAttached * pAttachment2 = static_cast(pAllAttachments->AddNewElt(EBML_INFO(KaxAttached))); + KaxAttached * pAttachment2 = &AddNewChild(*pAllAttachments); if (pAttachment2 == NULL) return -1; - KaxFileName * pFileName2 = static_cast(pAttachment2->FindFirstElt(EBML_INFO(KaxFileName), true)); + KaxFileName * pFileName2 = &GetChild(*pAttachment2); if (pFileName2 == NULL) return -1; pFileName2->SetValue(UTFstring{L"file2.txt"}); // Add a void element (data is discarded) - EbmlVoid * pVoid = static_cast(pAttachment2->FindFirstElt(EBML_INFO(EbmlVoid), true)); + EbmlVoid * pVoid = &GetChild(*pAttachment2); if (pVoid == NULL) return -1; static_cast(pVoid)->SetBuffer((const binary*) Buffer1, countof(Buffer1));