[cocos2d-x] Reverted takeBuffer PR so we are compatible with both 3.12 and < 3.12 cocos2d-x.

This commit is contained in:
badlogic 2016-08-01 11:43:22 +02:00
parent 0983d42c3d
commit e3e122b3fc

View File

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