MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / w

Method w

ogsr_engine/xrCore/FS.cpp:73–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71CMemoryWriter::~CMemoryWriter() { xr_free(data); }
72
73void CMemoryWriter::w(const void* ptr, size_t count)
74{
75 if (position + count > mem_size)
76 {
77 // reallocate
78 if (mem_size == 0)
79 mem_size = 1024 * 1024;
80 while (mem_size <= (position + count))
81 mem_size *= 2;
82 if (0 == data)
83 data = (BYTE*)xr_malloc(mem_size);
84 else
85 data = (BYTE*)xr_realloc(data, mem_size);
86 }
87 CopyMemory(data + position, ptr, count);
88 position += count;
89 if (position > file_size)
90 file_size = position;
91}
92
93void CMemoryWriter::reserve(const size_t count)
94{

Callers 15

saveMethod · 0.45
saveMethod · 0.45
SendUpdatesToAllMethod · 0.45
change_levelFunction · 0.45
jump_to_levelMethod · 0.45
saveMethod · 0.45
saveMethod · 0.45
dump_byte_codeFunction · 0.45
script_vars_exportFunction · 0.45

Calls 3

xr_mallocFunction · 0.85
xr_reallocFunction · 0.85
CopyMemoryFunction · 0.85

Tested by

no test coverage detected