Skip to content

Commit

Permalink
fix spine read file length not assignment bug (#1701)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnylanwanjun authored and pandamicro committed Mar 14, 2019
1 parent 5d00a40 commit 68893ee
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cocos/editor-support/spine-creator-support/spine-cocos2dx.cpp
Expand Up @@ -94,10 +94,12 @@ void _spAtlasPage_disposeTexture (spAtlasPage* self)

char* _spUtil_readFile (const char* path, int* length)
{
*length = 0;
Data data = FileUtils::getInstance()->getDataFromFile(FileUtils::getInstance()->fullPathForFilename(path));
if (data.isNull()) return 0;

char *ret = (char*)malloc(sizeof(unsigned char) * data.getSize());
memcpy(ret, (char*)data.getBytes(), data.getSize());
*length = (int)data.getSize();
return ret;
}

0 comments on commit 68893ee

Please sign in to comment.