MCPcopy Create free account
hub / github.com/axiomatic-systems/Bento4 / LoadString

Method LoadString

Source/C++/MetaData/Ap4MetaData.cpp:1543–1566  ·  view source on GitHub ↗

---------------------------------------------------------------------- | AP4_DataAtom::LoadString +---------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

1541| AP4_DataAtom::LoadString
1542+---------------------------------------------------------------------*/
1543AP4_Result
1544AP4_DataAtom::LoadString(AP4_String*& string)
1545{
1546 if (m_Source == NULL) {
1547 string = new AP4_String();
1548 return AP4_SUCCESS;
1549 } else {
1550 // create a string with enough capactiy for the data
1551 AP4_LargeSize size = 0;
1552 m_Source->GetSize(size);
1553 if (size > AP4_DATA_ATOM_MAX_SIZE) return AP4_ERROR_OUT_OF_RANGE;
1554 string = new AP4_String((AP4_Size)size);
1555
1556 // read from the start of the stream
1557 m_Source->Seek(0);
1558 AP4_Result result = m_Source->Read(string->UseChars(), (AP4_Size)size);
1559 if (AP4_FAILED(result)) {
1560 delete string;
1561 string = NULL;
1562 }
1563
1564 return result;
1565 }
1566}
1567
1568/*----------------------------------------------------------------------
1569| AP4_DataAtom::LoadBytes

Callers 1

ToStringMethod · 0.80

Calls 4

UseCharsMethod · 0.80
GetSizeMethod · 0.45
SeekMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected