MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / openToMem

Method openToMem

extlibs/soloud/src/core/soloud_file.cpp:198–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196 }
197
198 result MemoryFile::openToMem(const char *aFile)
199 {
200 if (!aFile)
201 return INVALID_PARAMETER;
202 if (mDataOwned)
203 delete[] mDataPtr;
204 mDataPtr = 0;
205 mOffset = 0;
206
207 DiskFile df;
208 int res = df.open(aFile);
209 if (res != SO_NO_ERROR)
210 return res;
211
212 mDataLength = df.length();
213 mDataPtr = new unsigned char[mDataLength];
214 if (mDataPtr == NULL)
215 return OUT_OF_MEMORY;
216 df.read(mDataPtr, mDataLength);
217 mDataOwned = true;
218 return SO_NO_ERROR;
219 }
220
221 result MemoryFile::openFileToMem(File *aFile)
222 {

Callers 1

loadToMemMethod · 0.80

Calls 3

openMethod · 0.45
lengthMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected