Skip to content

Commit

Permalink
#Use Data::takeBuffer replace deep copy data. (cocos2d#16263)
Browse files Browse the repository at this point in the history
  • Loading branch information
halx99 authored and minggo committed Jul 29, 2016
1 parent 7131451 commit 3a3f6bd
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions cocos/editor-support/spine/spine-cocos2dx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

0 comments on commit 3a3f6bd

Please sign in to comment.