MCPcopy Create free account
hub / github.com/ZDoom/Raze / AddFromBuffer

Method AddFromBuffer

source/common/filesystem/source/filesystem.cpp:300–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298//==========================================================================
299
300int FileSystem::AddFromBuffer(const char* name, char* data, int size, int id, int flags)
301{
302 FileReader fr;
303 FileData blob(data, size);
304 fr.OpenMemoryArray(blob);
305
306 // wrap this into a single lump resource file (should be done a little better later.)
307 auto rf = new FResourceFile(name, fr, stringpool);
308 auto Entries = rf->AllocateEntries(1);
309 Entries[0].FileName = rf->NormalizeFileName(ExtractBaseName(name, true).c_str());
310 Entries[0].ResourceID = -1;
311 Entries[0].Length = size;
312
313 Files.push_back(rf);
314 FileInfo.resize(FileInfo.size() + 1);
315 FileSystem::LumpRecord* lump_p = &FileInfo.back();
316 lump_p->SetFromLump(rf, 0, (int)Files.size() - 1, stringpool);
317 return (int)FileInfo.size() - 1;
318}
319
320//==========================================================================
321//

Callers 2

addMemoryResourceFunction · 0.80
RTS_IsInitializedFunction · 0.80

Calls 9

ExtractBaseNameFunction · 0.85
OpenMemoryArrayMethod · 0.80
AllocateEntriesMethod · 0.80
NormalizeFileNameMethod · 0.80
c_strMethod · 0.80
SetFromLumpMethod · 0.80
push_backMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected