Merge pull request #650 from halx99/patch-1

#Use Data::takeBuffer replace deep copy data.
This commit is contained in:
Mario Zechner 2016-07-28 08:53:23 +02:00 committed by GitHub
commit 482e28bb22

View File

@ -75,11 +75,8 @@ void _spAtlasPage_disposeTexture (spAtlasPage* self) {
}
char* _spUtil_readFile (const char* path, int* length) {
Data data = FileUtils::getInstance()->getDataFromFile(
FileUtils::getInstance()->fullPathForFilename(path).c_str());
Data data = FileUtils::getInstance()->getDataFromFile(
FileUtils::getInstance()->fullPathForFilename(path));
if (data.isNull()) return 0;
*length = static_cast<int>(data.getSize());
char* bytes = MALLOC(char, *length);
memcpy(bytes, data.getBytes(), *length);
return bytes;
return (char*)(data.takeBuffer((ssize_t*)length));
}