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

Method loadFile

extlibs/soloud/src/audiosource/openmpt/soloud_openmpt.cpp:102–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100 }
101
102 result Openmpt::loadFile(File *aFile)
103 {
104 if (mData)
105 {
106 delete[] mData;
107 }
108
109 mDataLen = aFile->length();
110 mData = new char[mDataLen];
111 if (!mData)
112 {
113 mData = 0;
114 mDataLen = 0;
115 return OUT_OF_MEMORY;
116 }
117 aFile->read((unsigned char*)mData, mDataLen);
118
119 void *mpf = openmpt_module_create_from_memory((const void*)mData, mDataLen, NULL, NULL, NULL);
120 if (!mpf)
121 {
122 delete[] mData;
123 mDataLen = 0;
124 return FILE_LOAD_FAILED;
125 }
126 openmpt_module_destroy(mpf);
127 return 0;
128 }
129
130 Openmpt::Openmpt()
131 {

Callers

nothing calls this directly

Calls 4

openmpt_module_destroyFunction · 0.85
lengthMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected