From 29779a460490298ebb34537a031be11375cd5a16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B3=B0=E3=80=80=E6=AD=A3=E5=8D=9A?= Date: Tue, 4 Nov 2014 10:21:57 +0900 Subject: [PATCH] modiry document->Parse((char*)pByte); to document->Parse((const char*)pByte); --- .../cocostudio/ActionTimeline/CCActionTimelineCache.cpp | 3 +-- cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp | 5 ++--- cocos/scripting/lua-bindings/manual/CCLuaStack.cpp | 6 +++--- cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp index 721edc1d77..6f04804ceb 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CCActionTimelineCache.cpp @@ -736,11 +736,10 @@ ActionTimeline* ActionTimelineCache::loadAnimationActionWithFileFromXML(const st //fix memory leak for v3.3 unsigned char* pByte = FileUtils::getInstance()->getFileData(fullpath, "r", &size);; - std::string content =(char*)pByte; // xml parse tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument(); - document->Parse(content.c_str()); + document->Parse((const char*)pByte); free(pByte); diff --git a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp index e9636b934d..206847d592 100644 --- a/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp +++ b/cocos/editor-support/cocostudio/ActionTimeline/CSLoader.cpp @@ -1256,12 +1256,11 @@ Node* CSLoader::nodeFromXMLFile(const std::string &fileName) ssize_t size; //fix memory leak for v3.3 - unsigned char* pByte = FileUtils::getInstance()->getFileData(fullpath, "r", &size);; - std::string content =(char*)pByte + unsigned char* pByte = FileUtils::getInstance()->getFileData(fullpath, "r", &size); // xml parse tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument(); - document->Parse(content.c_str()); + document->Parse((const char*)pByte); free(pByte); diff --git a/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp b/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp index 1933041efc..5a918d57eb 100644 --- a/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp +++ b/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp @@ -773,7 +773,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State *L) (unsigned char*)stack->_xxteaKey, (xxtea_long)stack->_xxteaKeyLen, &len); - delete []zipFileData; + free(zipFileData); zipFileData = nullptr; zip = ZipFile::createWithBuffer(buffer, len); } else { @@ -797,7 +797,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State *L) lua_setfield(L, -2, filename.c_str()); ++count; } - delete []zbuffer; + free(zbuffer); } filename = zip->getNextFilename(); } @@ -812,7 +812,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State *L) } if (zipFileData) { - delete []zipFileData; + free(zipFileData); } if (buffer) { diff --git a/cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp b/cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp index 732eed5a57..956e9b0cd7 100644 --- a/cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp +++ b/cocos/scripting/lua-bindings/manual/Cocos2dxLuaLoader.cpp @@ -108,7 +108,7 @@ extern "C" { LuaStack* stack = LuaEngine::getInstance()->getLuaStack(); stack->luaLoadBuffer(L, (char*)chunk, (int)chunkSize, chunkName.c_str()); - delete []chunk; + free(chunk); } else {