MCPcopy Create free account
hub / github.com/ddnet/ddnet / AddData

Method AddData

src/engine/shared/datafile.cpp:1086–1102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1084}
1085
1086int CDataFileWriter::AddData(size_t Size, const void *pData, ECompressionLevel CompressionLevel)
1087{
1088 dbg_assert(Size > 0 && pData != nullptr, "Data missing");
1089 dbg_assert(Size <= (size_t)std::numeric_limits<int>::max(), "Data too large");
1090 dbg_assert(m_vDatas.size() < (size_t)std::numeric_limits<int>::max(), "Too many data");
1091
1092 CDataInfo Info;
1093 Info.m_pUncompressedData = malloc(Size);
1094 mem_copy(Info.m_pUncompressedData, pData, Size);
1095 Info.m_UncompressedSize = Size;
1096 Info.m_pCompressedData = nullptr;
1097 Info.m_CompressedSize = 0;
1098 Info.m_CompressionLevel = CompressionLevel;
1099 m_vDatas.emplace_back(Info);
1100
1101 return m_vDatas.size() - 1;
1102}
1103
1104int CDataFileWriter::AddDataSwapped(size_t Size, const void *pData)
1105{

Callers 10

SaveMethod · 0.80
OnMapChangeMethod · 0.80
ResaveMapFunction · 0.80
ProcessFunction · 0.80
mainFunction · 0.80
SaveOutputMapFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
CreateEmptyMapFunction · 0.80
TESTFunction · 0.80

Calls 1

mem_copyFunction · 0.85

Tested by 1

TESTFunction · 0.64