diff --git a/extensions/spine/Skeleton.cpp b/extensions/spine/Skeleton.cpp index 2098860dc5..003d34adf8 100644 --- a/extensions/spine/Skeleton.cpp +++ b/extensions/spine/Skeleton.cpp @@ -58,7 +58,7 @@ Skeleton* Skeleton_create (SkeletonData* data) { SlotData *slotData = data->slots[i]; /* Find bone for the slotData's boneData. */ - Bone *bone; + Bone *bone = NULL; for (ii = 0; ii < self->boneCount; ++ii) { if (data->bones[ii] == slotData->boneData) { bone = self->bones[ii]; diff --git a/extensions/spine/extension.cpp b/extensions/spine/extension.cpp index 5cf307540c..8d6ef8f62f 100644 --- a/extensions/spine/extension.cpp +++ b/extensions/spine/extension.cpp @@ -59,8 +59,9 @@ char* _readFile (const char* path, int* length) { fseek(file, 0, SEEK_SET); char* data = MALLOC(char, *length); - fread(data, 1, *length, file); + int rtn = fread(data, 1, *length, file); fclose(file); + if (rtn != *length) return 0; return data; } diff --git a/scripting/lua/cocos2dx_support/Cocos2dxLuaLoader.cpp b/scripting/lua/cocos2dx_support/Cocos2dxLuaLoader.cpp index 5f192490aa..812c813d1e 100644 --- a/scripting/lua/cocos2dx_support/Cocos2dxLuaLoader.cpp +++ b/scripting/lua/cocos2dx_support/Cocos2dxLuaLoader.cpp @@ -32,7 +32,7 @@ extern "C" int cocos2dx_lua_loader(lua_State *L) { std::string filename(luaL_checkstring(L, 1)); - int pos = filename.rfind(".lua"); + size_t pos = filename.rfind(".lua"); if (pos != std::string::npos) { filename = filename.substr(0, pos);