Skip to content

Commit

Permalink
fix building tests after Unicode API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
robUx4 committed Dec 28, 2023
1 parent 979cc98 commit efa0e4d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 31 deletions.
6 changes: 3 additions & 3 deletions test/ebml/test00.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ int main(void)
KaxFileName * pFileName1 = static_cast<KaxFileName *>(pAttachment1->FindFirstElt(EBML_INFO(KaxFileName), true));
if (pFileName1 == NULL)
return -1;
*static_cast<EbmlUnicodeString *>(pFileName1) = L"file1.txt";
*static_cast<EbmlUnicodeString *>(pFileName1) = UTFstring{L"file1.txt"};
KaxFileData * pFileData1 = static_cast<KaxFileData *>(pAttachment1->FindFirstElt(EBML_INFO(KaxFileData), true));
if (pFileData1 == NULL)
return -1;
Expand All @@ -88,7 +88,7 @@ int main(void)
KaxFileName * pFileName2 = static_cast<KaxFileName *>(pAttachment2->FindFirstElt(EBML_INFO(KaxFileName), true));
if (pFileName2 == NULL)
return -1;
*static_cast<EbmlUnicodeString *>(pFileName2) = L"file2.txt";
*static_cast<EbmlUnicodeString *>(pFileName2) = UTFstring{L"file2.txt"};
// Add a void element (data is discarded)
EbmlVoid * pVoid = static_cast<EbmlVoid *>(pAttachment2->FindFirstElt(EBML_INFO(EbmlVoid), true));
if (pVoid == NULL)
Expand Down Expand Up @@ -178,7 +178,7 @@ int main(void)
if (EbmlId(*ElementLevel3) == EBML_ID(KaxFileName)) {
KaxFileName & tmp = *static_cast<KaxFileName*>(ElementLevel3);
tmp.ReadData(aStream.I_O());
printf("File Name = %ls\n", UTFstring(tmp).c_str());
printf("File Name = %s\n", UTFstring(tmp).GetUTF8().c_str());
} else {
ElementLevel3->SkipData(aStream, KaxAttached_Context);
}
Expand Down
12 changes: 6 additions & 6 deletions test/mux/test6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ int main(int argc, char **argv)
KaxDuration & SegDuration = GetChild<KaxDuration>(MyInfos);
*(static_cast<EbmlFloat *>(&SegDuration)) = 0.0;

*((EbmlUnicodeString *)&GetChild<KaxMuxingApp>(MyInfos)) = L"libmatroska 0.5.0";
*((EbmlUnicodeString *)&GetChild<KaxWritingApp>(MyInfos)) = L"����";
*((EbmlUnicodeString *)&GetChild<KaxMuxingApp>(MyInfos)) = UTFstring{L"libmatroska 0.5.0"};
*((EbmlUnicodeString *)&GetChild<KaxWritingApp>(MyInfos)) = UTFstring{L"����"};
GetChild<KaxWritingApp>(MyInfos).SetDefaultSize(25);

filepos_t InfoSize = MyInfos.Render(out_file);
Expand Down Expand Up @@ -289,14 +289,14 @@ int main(int argc, char **argv)

KaxChapterDisplay & aDisplay = GetChild<KaxChapterDisplay>(aAtom);
KaxChapterString & aChapString = GetChild<KaxChapterString>(aDisplay);
*static_cast<EbmlUnicodeString *>(&aChapString) = L"Le film r�duit � un chapitre";
*static_cast<EbmlUnicodeString *>(&aChapString) = UTFstring{L"Le film r�duit � un chapitre"};

KaxChapterLanguage & aChapLang = GetChild<KaxChapterLanguage>(aDisplay);
*static_cast<EbmlString *>(&aChapLang) = "fra";

KaxChapterDisplay & aDisplay2 = GetNextChild<KaxChapterDisplay>(aAtom, aDisplay);
KaxChapterString & aChapString2 = GetChild<KaxChapterString>(aDisplay2);
*static_cast<EbmlUnicodeString *>(&aChapString2) = L"The movie in one chapter";
*static_cast<EbmlUnicodeString *>(&aChapString2) = UTFstring{L"The movie in one chapter"};

KaxChapterLanguage & aChapLang2 = GetChild<KaxChapterLanguage>(aDisplay2);
*static_cast<EbmlString *>(&aChapLang2) = "eng";
Expand All @@ -318,10 +318,10 @@ int main(int argc, char **argv)
*static_cast<EbmlUInteger *>(&ChapterUID) = 0x67890;

KaxTagName & aTagName = GetChild<KaxTagName>(TagSimple);
*static_cast<EbmlUnicodeString *>(&aTagName) = L"NAME";
*static_cast<EbmlUnicodeString *>(&aTagName) = UTFstring{L"NAME"};

KaxTagString & aTagtring = GetChild<KaxTagString>(TagSimple);
*static_cast<EbmlUnicodeString *>(&aTagtring) = L"Test�123";
*static_cast<EbmlUnicodeString *>(&aTagtring) = UTFstring{L"Test�123"};

filepos_t TagsSize = AllTags.Render(out_file, bWriteDefaultValues);
MetaSeek.IndexThis(AllTags, FileSegment);
Expand Down
18 changes: 3 additions & 15 deletions test/mux/test8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,19 +238,11 @@ int main(int argc, char **argv)
} else if (EbmlId(*ElementLevel2) == EBML_ID(KaxMuxingApp)) {
KaxMuxingApp *pApp = static_cast<KaxMuxingApp*>(ElementLevel2);
pApp->ReadData(aStream.I_O());
#if !defined(__CYGWIN__) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__NetBSD__)
wprintf(L"Muxing App : %ls\n", UTFstring(*pApp).c_str());
#else
printf("Muxing App : %ls\n", UTFstring(*pApp).c_str());
#endif
printf("Muxing App : %s\n", UTFstring(*pApp).GetUTF8().c_str());
} else if (EbmlId(*ElementLevel2) == EBML_ID(KaxWritingApp)) {
KaxWritingApp *pApp = static_cast<KaxWritingApp*>(ElementLevel2);
pApp->ReadData(aStream.I_O());
#if !defined(__CYGWIN__) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__NetBSD__)
wprintf(L"Writing App : %ls (����)\n", UTFstring(*pApp).c_str());
#else
printf("Writing App : %ls (����)\n", UTFstring(*pApp).c_str());
#endif
printf("Writing App : %s (����)\n", UTFstring(*pApp).GetUTF8().c_str());
}

if (UpperElementLevel > 0) {
Expand Down Expand Up @@ -561,11 +553,7 @@ int main(int argc, char **argv)
unsigned int Index4;
for (Index4 = 0; Index4<aDisplay.ListSize() ;Index4++) {
if (EbmlId(*(aDisplay[Index4])) == EBML_ID(KaxChapterString)) {
#if !defined(__CYGWIN__) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__NetBSD__)
wprintf(L" Display \"%s\"\n", UTFstring(*static_cast<EbmlUnicodeString *>(aDisplay[Index4])).c_str() );
#else
printf(" Display \"%ls\"\n", UTFstring(*static_cast<EbmlUnicodeString *>(aDisplay[Index4])).c_str() );
#endif
printf(" Display \"%s\"\n", UTFstring(*static_cast<EbmlUnicodeString *>(aDisplay[Index4])).GetUTF8().c_str() );
} else if (EbmlId(*(aDisplay[Index4])) == EBML_ID(KaxChapterLanguage)) {
printf(" For language \"%s\"\n", std::string(*static_cast<EbmlString *>(aDisplay[Index4])).c_str() );
} else if (EbmlId(*(aDisplay[Index4])) == EBML_ID(KaxChapterCountry)) {
Expand Down
14 changes: 7 additions & 7 deletions test/tags/test9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,25 @@ int main() {

KaxTagSimple &stag_l1 = GetChild<KaxTagSimple>(tag);
*(static_cast<EbmlUnicodeString *>(&GetChild<KaxTagName>(stag_l1))) =
L"SIMPLE_TAG_NAME_LEVEL1_1";
UTFstring{L"SIMPLE_TAG_NAME_LEVEL1_1"};
*(static_cast<EbmlUnicodeString *>(&GetChild<KaxTagString>(stag_l1))) =
L"SIMPLE_TAG_STRING_LEVEL1_1";
UTFstring{L"SIMPLE_TAG_STRING_LEVEL1_1"};
KaxTagSimple &stag_l1_2 = GetNextChild<KaxTagSimple>(tag, stag_l1);
*(static_cast<EbmlUnicodeString *>(&GetChild<KaxTagName>(stag_l1_2))) =
L"SIMPLE_TAG_NAME_LEVEL1_2";
UTFstring{L"SIMPLE_TAG_NAME_LEVEL1_2"};
KaxTagBinary &tbin = GetChild<KaxTagBinary>(stag_l1_2);
tbin.CopyBuffer((binary *)"SIMPLE_TAG_BINARY_LEVEL1_2",
strlen("SIMPLE_TAG_BINARY_LEVEL1_2"));
KaxTagSimple &stag_l2 = GetChild<KaxTagSimple>(stag_l1);
*(static_cast<EbmlUnicodeString *>(&GetChild<KaxTagName>(stag_l2))) =
L"SIMPLE_TAG_NAME_LEVEL2";
UTFstring{L"SIMPLE_TAG_NAME_LEVEL2"};
*(static_cast<EbmlUnicodeString *>(&GetChild<KaxTagString>(stag_l2))) =
L"SIMPLE_TAG_STRING_LEVEL2";
UTFstring{L"SIMPLE_TAG_STRING_LEVEL2"};
KaxTagSimple &stag_l3 = GetChild<KaxTagSimple>(stag_l2);
*(static_cast<EbmlUnicodeString *>(&GetChild<KaxTagName>(stag_l3))) =
L"SIMPLE_TAG_NAME_LEVEL3";
UTFstring{L"SIMPLE_TAG_NAME_LEVEL3"};
*(static_cast<EbmlUnicodeString *>(&GetChild<KaxTagString>(stag_l3))) =
L"SIMPLE_TAG_STRING_LEVEL3";
UTFstring{L"SIMPLE_TAG_STRING_LEVEL3"};

tags.Render(out);

Expand Down

0 comments on commit efa0e4d

Please sign in to comment.