From 5c828e9d15ca82dacddd970d86eaa8ca92529d0e Mon Sep 17 00:00:00 2001 From: owen <1053210246@qq.com> Date: Thu, 14 Mar 2019 17:29:20 +0800 Subject: [PATCH] fix spine read file length not assignment bug (#1701) --- .../editor-support/spine-creator-support/spine-cocos2dx.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/native/cocos/editor-support/spine-creator-support/spine-cocos2dx.cpp b/native/cocos/editor-support/spine-creator-support/spine-cocos2dx.cpp index 8cd2e1f5da..27f42509aa 100644 --- a/native/cocos/editor-support/spine-creator-support/spine-cocos2dx.cpp +++ b/native/cocos/editor-support/spine-creator-support/spine-cocos2dx.cpp @@ -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; }