modiry document->Parse((char*)pByte); to document->Parse((const char*)pByte);

This commit is contained in:
峰 正博 2014-11-04 10:21:57 +09:00
parent 85fb2c91ab
commit 29779a4604
4 changed files with 7 additions and 9 deletions

View File

@ -736,11 +736,10 @@ ActionTimeline* ActionTimelineCache::loadAnimationActionWithFileFromXML(const st
//fix memory leak for v3.3 //fix memory leak for v3.3
unsigned char* pByte = FileUtils::getInstance()->getFileData(fullpath, "r", &size);; unsigned char* pByte = FileUtils::getInstance()->getFileData(fullpath, "r", &size);;
std::string content =(char*)pByte;
// xml parse // xml parse
tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument(); tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument();
document->Parse(content.c_str()); document->Parse((const char*)pByte);
free(pByte); free(pByte);

View File

@ -1256,12 +1256,11 @@ Node* CSLoader::nodeFromXMLFile(const std::string &fileName)
ssize_t size; ssize_t size;
//fix memory leak for v3.3 //fix memory leak for v3.3
unsigned char* pByte = FileUtils::getInstance()->getFileData(fullpath, "r", &size);; unsigned char* pByte = FileUtils::getInstance()->getFileData(fullpath, "r", &size);
std::string content =(char*)pByte
// xml parse // xml parse
tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument(); tinyxml2::XMLDocument* document = new tinyxml2::XMLDocument();
document->Parse(content.c_str()); document->Parse((const char*)pByte);
free(pByte); free(pByte);

View File

@ -773,7 +773,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State *L)
(unsigned char*)stack->_xxteaKey, (unsigned char*)stack->_xxteaKey,
(xxtea_long)stack->_xxteaKeyLen, (xxtea_long)stack->_xxteaKeyLen,
&len); &len);
delete []zipFileData; free(zipFileData);
zipFileData = nullptr; zipFileData = nullptr;
zip = ZipFile::createWithBuffer(buffer, len); zip = ZipFile::createWithBuffer(buffer, len);
} else { } else {
@ -797,7 +797,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State *L)
lua_setfield(L, -2, filename.c_str()); lua_setfield(L, -2, filename.c_str());
++count; ++count;
} }
delete []zbuffer; free(zbuffer);
} }
filename = zip->getNextFilename(); filename = zip->getNextFilename();
} }
@ -812,7 +812,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State *L)
} }
if (zipFileData) { if (zipFileData) {
delete []zipFileData; free(zipFileData);
} }
if (buffer) { if (buffer) {

View File

@ -108,7 +108,7 @@ extern "C"
{ {
LuaStack* stack = LuaEngine::getInstance()->getLuaStack(); LuaStack* stack = LuaEngine::getInstance()->getLuaStack();
stack->luaLoadBuffer(L, (char*)chunk, (int)chunkSize, chunkName.c_str()); stack->luaLoadBuffer(L, (char*)chunk, (int)chunkSize, chunkName.c_str());
delete []chunk; free(chunk);
} }
else else
{ {