MCPcopy Create free account
hub / github.com/MediaArea/MediaInfoLib / Load

Function Load

Source/PreRelease/FieldsDescription.cpp:28–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26};
27
28ZtringListList Load(const string& Name, const char* ToAdd = nullptr, bool IgnoreErrors = false) {
29 File InF(Ztring().From_Local(Name));
30 auto InF_Size = InF.Size_Get();
31 if (InF_Size > ((size_t)-1) / 2)
32 return {};
33 auto Size = (size_t)InF_Size;
34 if (Size == 0) {
35 if (!IgnoreErrors)
36 std::cerr << "Can not open " << Name << '\n';
37 return {};
38 }
39 uint8_t* Buffer = new uint8_t[Size];
40 if (InF.Read(Buffer, Size) != Size) {
41 if (!IgnoreErrors)
42 std::cerr << "Can not read " << Name << '\n';
43 return {};
44 }
45 Ztring In;
46 In.From_UTF8((const char*)Buffer, Size);
47 delete[] Buffer;
48
49 if (ToAdd) {
50 In += Ztring().From_UTF8(ToAdd);
51 }
52
53 ZtringListList List;
54 List.Write(In);
55 if (List.empty()) {
56 if (!IgnoreErrors)
57 std::cerr << "Can not extract " << Name << '\n';
58 }
59
60 return std::move(List);
61}
62
63
64int main(int argc, char* argv[]) {

Callers 5

mainFunction · 0.85
GraphSvgPluginStateMethod · 0.85
CanHandleUrlsMethod · 0.85
Format_TestMethod · 0.85
Dot2SvgFunction · 0.85

Calls 2

WriteMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected