mirror of https://github.com/axmolengine/axmol.git
#Use Data::takeBuffer replace deep copy data. (#16263)
see: https://github.com/EsotericSoftware/spine-runtimes/pull/650
This commit is contained in:
parent
7131451f1b
commit
3a3f6bd385
|
@ -75,11 +75,8 @@ void _spAtlasPage_disposeTexture (spAtlasPage* self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char* _spUtil_readFile (const char* path, int* length) {
|
char* _spUtil_readFile (const char* path, int* length) {
|
||||||
Data data = FileUtils::getInstance()->getDataFromFile(
|
Data data = FileUtils::getInstance()->getDataFromFile(
|
||||||
FileUtils::getInstance()->fullPathForFilename(path).c_str());
|
FileUtils::getInstance()->fullPathForFilename(path));
|
||||||
if (data.isNull()) return 0;
|
if (data.isNull()) return 0;
|
||||||
*length = static_cast<int>(data.getSize());
|
return (char*)(data.takeBuffer((ssize_t*)length));
|
||||||
char* bytes = MALLOC(char, *length);
|
|
||||||
memcpy(bytes, data.getBytes(), *length);
|
|
||||||
return bytes;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue