From d319436cdc12f12d37c8e207f25dbf1084646333 Mon Sep 17 00:00:00 2001 From: halx99 Date: Sun, 24 Nov 2019 19:17:23 +0800 Subject: [PATCH] Remove xxtea. --- cocos/scripting/lua-bindings/CMakeLists.txt | 2 - .../lua-bindings/manual/CCLuaStack.cpp | 38 ++----------------- 2 files changed, 4 insertions(+), 36 deletions(-) diff --git a/cocos/scripting/lua-bindings/CMakeLists.txt b/cocos/scripting/lua-bindings/CMakeLists.txt index ff22348108..bfb002f441 100644 --- a/cocos/scripting/lua-bindings/CMakeLists.txt +++ b/cocos/scripting/lua-bindings/CMakeLists.txt @@ -13,7 +13,6 @@ set(lua_bindings_manual_headers manual/platform/ios/CCLuaObjcBridge.h manual/network/lua_cocos2dx_network_manual.h manual/network/lua_xml_http_request.h - manual/network/Lua_web_socket.h manual/network/lua_extensions.h manual/network/lua_downloader.h manual/audioengine/lua_cocos2dx_audioengine_manual.h @@ -56,7 +55,6 @@ set(lua_bindings_manual_files manual/extension/lua_cocos2dx_extension_manual.cpp manual/network/lua_extensions.c manual/network/lua_cocos2dx_network_manual.cpp - manual/network/Lua_web_socket.cpp manual/network/lua_xml_http_request.cpp manual/network/lua_downloader.cpp #manual/spine/lua_cocos2dx_spine_manual.cpp diff --git a/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp b/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp index 2767ca0234..2ada85319c 100644 --- a/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp +++ b/cocos/scripting/lua-bindings/manual/CCLuaStack.cpp @@ -27,7 +27,6 @@ #include "scripting/lua-bindings/manual/CCLuaStack.h" #include "scripting/lua-bindings/manual/tolua_fix.h" #include -#include "external/xxtea/xxtea.h" extern "C" { #include "lua.h" #include "tolua++.h" @@ -776,19 +775,8 @@ int LuaStack::luaLoadChunksFromZIP(lua_State *L) bool isXXTEA = stack && stack->_xxteaEnabled && size >= stack->_xxteaSignLen && memcmp(stack->_xxteaSign, bytes, stack->_xxteaSignLen) == 0; - - if (isXXTEA) { // decrypt XXTEA - xxtea_long len = 0; - buffer = xxtea_decrypt(bytes + stack->_xxteaSignLen, - (xxtea_long)size - (xxtea_long)stack->_xxteaSignLen, - (unsigned char*)stack->_xxteaKey, - (xxtea_long)stack->_xxteaKeyLen, - &len); - zip = ZipFile::createWithBuffer(buffer, len); - } else { - if (size > 0) { - zip = ZipFile::createWithBuffer(bytes, (unsigned long)size); - } + if (size > 0) { + zip = ZipFile::createWithBuffer(bytes, (unsigned long)size); } if (zip) { @@ -865,26 +853,8 @@ int LuaStack::luaLoadBuffer(lua_State *L, const char *chunk, int chunkSize, cons { int r = 0; - if (_xxteaEnabled && strncmp(chunk, _xxteaSign, _xxteaSignLen) == 0) - { - // decrypt XXTEA - xxtea_long len = 0; - unsigned char* result = xxtea_decrypt((unsigned char*)chunk + _xxteaSignLen, - (xxtea_long)chunkSize - _xxteaSignLen, - (unsigned char*)_xxteaKey, - (xxtea_long)_xxteaKeyLen, - &len); - unsigned char* content = result; - xxtea_long contentSize = len; - skipBOM((const char*&)content, (int&)contentSize); - r = luaL_loadbuffer(L, (char*)content, contentSize, chunkName); - free(result); - } - else - { - skipBOM(chunk, chunkSize); - r = luaL_loadbuffer(L, chunk, chunkSize, chunkName); - } + skipBOM(chunk, chunkSize); + r = luaL_loadbuffer(L, chunk, chunkSize, chunkName); #if defined(COCOS2D_DEBUG) && COCOS2D_DEBUG > 0 if (r)