diff --git a/cocos/base/ZipUtils.cpp b/cocos/base/ZipUtils.cpp index bd98212bb0..d279fae2cc 100644 --- a/cocos/base/ZipUtils.cpp +++ b/cocos/base/ZipUtils.cpp @@ -634,7 +634,7 @@ struct ZipFilePrivate zlib_filefunc_def functionOverrides{}; }; -ZipFile *ZipFile::createWithBuffer(const void* buffer, uLong size) +ZipFile *ZipFile::createWithBuffer(const void* buffer, unsigned int size) { ZipFile *zip = new (std::nothrow) ZipFile(); if (zip && zip->initWithBuffer(buffer, size)) { @@ -858,7 +858,7 @@ int ZipFile::getCurrentFileInfo(std::string* filename, unz_file_info_s* info) { return ret; } -bool ZipFile::initWithBuffer(const void *buffer, uLong size) +bool ZipFile::initWithBuffer(const void *buffer, unsigned int size) { if (!buffer || size == 0) return false; diff --git a/cocos/base/ZipUtils.h b/cocos/base/ZipUtils.h index 1fc3de4bbf..610c1f38ba 100644 --- a/cocos/base/ZipUtils.h +++ b/cocos/base/ZipUtils.h @@ -293,7 +293,7 @@ namespace cocos2d std::string getFirstFilename(); std::string getNextFilename(); - static ZipFile *createWithBuffer(const void* buffer, unsigned long size); + static ZipFile *createWithBuffer(const void* buffer, unsigned int size); /** * zipFile Streaming support, !!!important, the file in zip must no compress level, otherwise @@ -319,7 +319,7 @@ namespace cocos2d /* Only used internal for createWithBuffer() */ ZipFile(); - bool initWithBuffer(const void *buffer, unsigned long size); + bool initWithBuffer(const void *buffer, unsigned int size); int getCurrentFileInfo(std::string* filename, unz_file_info_s* info); /** Internal data like zip file pointer / file list array and so on */ diff --git a/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp b/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp index fcd09f828d..866e1ca34a 100644 --- a/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp +++ b/extensions/scripting/lua-bindings/auto/lua_cocos2dx_auto.cpp @@ -50991,7 +50991,7 @@ int lua_cocos2dx_AtlasNode_setQuadsToDraw(lua_State* tolua_S) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "cc.AtlasNode:setQuadsToDraw"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "cc.AtlasNode:setQuadsToDraw"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_AtlasNode_setQuadsToDraw'", nullptr); @@ -89469,7 +89469,7 @@ int lua_cocos2dx_Technique_getPassByIndex(lua_State* tolua_S) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "cc.Technique:getPassByIndex"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "cc.Technique:getPassByIndex"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Technique_getPassByIndex'", nullptr); @@ -89836,7 +89836,7 @@ int lua_cocos2dx_Material_getTechniqueByIndex(lua_State* tolua_S) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "cc.Material:getTechniqueByIndex"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "cc.Material:getTechniqueByIndex"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Material_getTechniqueByIndex'", nullptr); @@ -92743,7 +92743,7 @@ int lua_cocos2dx_Renderer_addDrawnVertices(lua_State* tolua_S) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "cc.Renderer:addDrawnVertices"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "cc.Renderer:addDrawnVertices"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Renderer_addDrawnVertices'", nullptr); @@ -93425,7 +93425,7 @@ int lua_cocos2dx_Renderer_addDrawnBatches(lua_State* tolua_S) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "cc.Renderer:addDrawnBatches"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "cc.Renderer:addDrawnBatches"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_Renderer_addDrawnBatches'", nullptr); @@ -96797,7 +96797,7 @@ int lua_cocos2dx_SpriteBatchNode_removeChildAtIndex(lua_State* tolua_S) ssize_t arg0; bool arg1; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "cc.SpriteBatchNode:removeChildAtIndex"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "cc.SpriteBatchNode:removeChildAtIndex"); ok &= luaval_to_boolean(tolua_S, 3,&arg1, "cc.SpriteBatchNode:removeChildAtIndex"); if(!ok) @@ -97169,7 +97169,7 @@ int lua_cocos2dx_SpriteBatchNode_initWithTexture(lua_State* tolua_S) ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.SpriteBatchNode:initWithTexture"); - ok &= luaval_to_ssize(tolua_S, 3, &arg1, "cc.SpriteBatchNode:initWithTexture"); + ok &= luaval_to_ssize_t(tolua_S, 3, &arg1, "cc.SpriteBatchNode:initWithTexture"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_initWithTexture'", nullptr); @@ -97269,7 +97269,7 @@ int lua_cocos2dx_SpriteBatchNode_reserveCapacity(lua_State* tolua_S) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "cc.SpriteBatchNode:reserveCapacity"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "cc.SpriteBatchNode:reserveCapacity"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_reserveCapacity'", nullptr); @@ -97372,7 +97372,7 @@ int lua_cocos2dx_SpriteBatchNode_insertQuadFromSprite(lua_State* tolua_S) ok &= luaval_to_object(tolua_S, 2, "cc.Sprite",&arg0, "cc.SpriteBatchNode:insertQuadFromSprite"); - ok &= luaval_to_ssize(tolua_S, 3, &arg1, "cc.SpriteBatchNode:insertQuadFromSprite"); + ok &= luaval_to_ssize_t(tolua_S, 3, &arg1, "cc.SpriteBatchNode:insertQuadFromSprite"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_insertQuadFromSprite'", nullptr); @@ -97439,7 +97439,7 @@ int lua_cocos2dx_SpriteBatchNode_initWithFile(lua_State* tolua_S) ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.SpriteBatchNode:initWithFile"); - ok &= luaval_to_ssize(tolua_S, 3, &arg1, "cc.SpriteBatchNode:initWithFile"); + ok &= luaval_to_ssize_t(tolua_S, 3, &arg1, "cc.SpriteBatchNode:initWithFile"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_initWithFile'", nullptr); @@ -97542,7 +97542,7 @@ int lua_cocos2dx_SpriteBatchNode_rebuildIndexInOrder(lua_State* tolua_S) ok &= luaval_to_object(tolua_S, 2, "cc.Sprite",&arg0, "cc.SpriteBatchNode:rebuildIndexInOrder"); - ok &= luaval_to_ssize(tolua_S, 3, &arg1, "cc.SpriteBatchNode:rebuildIndexInOrder"); + ok &= luaval_to_ssize_t(tolua_S, 3, &arg1, "cc.SpriteBatchNode:rebuildIndexInOrder"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_rebuildIndexInOrder'", nullptr); @@ -97692,7 +97692,7 @@ int lua_cocos2dx_SpriteBatchNode_create(lua_State* tolua_S) std::string arg0; ssize_t arg1; ok &= luaval_to_std_string(tolua_S, 2,&arg0, "cc.SpriteBatchNode:create"); - ok &= luaval_to_ssize(tolua_S, 3, &arg1, "cc.SpriteBatchNode:create"); + ok &= luaval_to_ssize_t(tolua_S, 3, &arg1, "cc.SpriteBatchNode:create"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_create'", nullptr); @@ -97743,7 +97743,7 @@ int lua_cocos2dx_SpriteBatchNode_createWithTexture(lua_State* tolua_S) cocos2d::Texture2D* arg0; ssize_t arg1; ok &= luaval_to_object(tolua_S, 2, "cc.Texture2D",&arg0, "cc.SpriteBatchNode:createWithTexture"); - ok &= luaval_to_ssize(tolua_S, 3, &arg1, "cc.SpriteBatchNode:createWithTexture"); + ok &= luaval_to_ssize_t(tolua_S, 3, &arg1, "cc.SpriteBatchNode:createWithTexture"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_SpriteBatchNode_createWithTexture'", nullptr); diff --git a/extensions/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp b/extensions/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp index 1bd78e80ad..31cef92257 100644 --- a/extensions/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp +++ b/extensions/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp @@ -18128,7 +18128,7 @@ int lua_cocos2dx_ui_ListView_scrollToItem(lua_State* tolua_S) do{ if (argc == 4) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:scrollToItem"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.ListView:scrollToItem"); if (!ok) { break; } cocos2d::Vec2 arg1; @@ -18152,7 +18152,7 @@ int lua_cocos2dx_ui_ListView_scrollToItem(lua_State* tolua_S) do{ if (argc == 3) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:scrollToItem"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.ListView:scrollToItem"); if (!ok) { break; } cocos2d::Vec2 arg1; @@ -18211,7 +18211,7 @@ int lua_cocos2dx_ui_ListView_jumpToItem(lua_State* tolua_S) cocos2d::Vec2 arg1; cocos2d::Vec2 arg2; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:jumpToItem"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.ListView:jumpToItem"); ok &= luaval_to_vec2(tolua_S, 3, &arg1, "ccui.ListView:jumpToItem"); @@ -18465,7 +18465,7 @@ int lua_cocos2dx_ui_ListView_insertDefaultItem(lua_State* tolua_S) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:insertDefaultItem"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.ListView:insertDefaultItem"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_insertDefaultItem'", nullptr); @@ -19154,7 +19154,7 @@ int lua_cocos2dx_ui_ListView_getItem(lua_State* tolua_S) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:getItem"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.ListView:getItem"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_getItem'", nullptr); @@ -19204,7 +19204,7 @@ int lua_cocos2dx_ui_ListView_removeItem(lua_State* tolua_S) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.ListView:removeItem"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.ListView:removeItem"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_removeItem'", nullptr); @@ -19801,7 +19801,7 @@ int lua_cocos2dx_ui_ListView_insertCustomItem(lua_State* tolua_S) ok &= luaval_to_object(tolua_S, 2, "ccui.Widget",&arg0, "ccui.ListView:insertCustomItem"); - ok &= luaval_to_ssize(tolua_S, 3, &arg1, "ccui.ListView:insertCustomItem"); + ok &= luaval_to_ssize_t(tolua_S, 3, &arg1, "ccui.ListView:insertCustomItem"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_insertCustomItem'", nullptr); @@ -25185,7 +25185,7 @@ int lua_cocos2dx_ui_PageView_setCurrentPageIndex(lua_State* tolua_S) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:setCurrentPageIndex"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.PageView:setCurrentPageIndex"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_setCurrentPageIndex'", nullptr); @@ -25467,7 +25467,7 @@ int lua_cocos2dx_ui_PageView_scrollToPage(lua_State* tolua_S) do{ if (argc == 2) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:scrollToPage"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.PageView:scrollToPage"); if (!ok) { break; } double arg1; @@ -25483,7 +25483,7 @@ int lua_cocos2dx_ui_PageView_scrollToPage(lua_State* tolua_S) do{ if (argc == 1) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:scrollToPage"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.PageView:scrollToPage"); if (!ok) { break; } cobj->scrollToPage(arg0); @@ -25576,7 +25576,7 @@ int lua_cocos2dx_ui_PageView_scrollToItem(lua_State* tolua_S) do{ if (argc == 2) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:scrollToItem"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.PageView:scrollToItem"); if (!ok) { break; } double arg1; @@ -25592,7 +25592,7 @@ int lua_cocos2dx_ui_PageView_scrollToItem(lua_State* tolua_S) do{ if (argc == 1) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:scrollToItem"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.PageView:scrollToItem"); if (!ok) { break; } cobj->scrollToItem(arg0); @@ -25996,7 +25996,7 @@ int lua_cocos2dx_ui_PageView_removePageAtIndex(lua_State* tolua_S) { ssize_t arg0; - ok &= luaval_to_ssize(tolua_S, 2, &arg0, "ccui.PageView:removePageAtIndex"); + ok &= luaval_to_ssize_t(tolua_S, 2, &arg0, "ccui.PageView:removePageAtIndex"); if(!ok) { tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_PageView_removePageAtIndex'", nullptr); diff --git a/extensions/scripting/lua-bindings/manual/3d/lua_cocos2dx_3d_manual.cpp b/extensions/scripting/lua-bindings/manual/3d/lua_cocos2dx_3d_manual.cpp index 3dd96318e0..1fc5bc0875 100644 --- a/extensions/scripting/lua-bindings/manual/3d/lua_cocos2dx_3d_manual.cpp +++ b/extensions/scripting/lua-bindings/manual/3d/lua_cocos2dx_3d_manual.cpp @@ -909,7 +909,7 @@ int lua_cocos2dx_3d_AABB_updateMinMax(lua_State* L) ok &= luaval_to_object(L, 2, "cc.Vec3",&arg0, "cc.AABB:updateMinMax"); - ok &= luaval_to_ssize(L, 3, &arg1, "cc.AABB:updateMinMax"); + ok &= luaval_to_ssize_t(L, 3, &arg1, "cc.AABB:updateMinMax"); if(!ok) return 0; cobj->updateMinMax(arg0, arg1); diff --git a/extensions/scripting/lua-bindings/manual/LuaBasicConversions.cpp b/extensions/scripting/lua-bindings/manual/LuaBasicConversions.cpp index ded1bb26b6..846e2b5d97 100644 --- a/extensions/scripting/lua-bindings/manual/LuaBasicConversions.cpp +++ b/extensions/scripting/lua-bindings/manual/LuaBasicConversions.cpp @@ -528,12 +528,7 @@ bool luaval_to_physics_material(lua_State* L,int lo,PhysicsMaterial* outValue, c } #endif //#if CC_USE_PHYSICS -bool luaval_to_ssize(lua_State* L,int lo, ssize_t* outValue, const char* funcName) -{ - return luaval_to_long(L, lo, reinterpret_cast(outValue)); -} - -bool luaval_to_long(lua_State* L,int lo, long* outValue, const char* funcName) +bool luaval_to_ssize_t(lua_State* L, int lo, ssize_t* outValue, const char* funcName) { if (NULL == L || NULL == outValue) return false; @@ -551,13 +546,13 @@ bool luaval_to_long(lua_State* L,int lo, long* outValue, const char* funcName) if (ok) { - *outValue = (long)tolua_tonumber(L, lo, 0); + *outValue = (ssize_t)tolua_tointeger(L, lo, 0); } return ok; } -bool luaval_to_ulong(lua_State* L,int lo, unsigned long* outValue, const char* funcName) +bool luaval_to_size_t(lua_State* L,int lo, size_t* outValue, const char* funcName) { if (NULL == L || NULL == outValue) return false; @@ -575,7 +570,7 @@ bool luaval_to_ulong(lua_State* L,int lo, unsigned long* outValue, const char* f if (ok) { - *outValue = (unsigned long)tolua_tonumber(L, lo, 0); + *outValue = (size_t)tolua_tointeger(L, lo, 0); } return ok; diff --git a/extensions/scripting/lua-bindings/manual/LuaBasicConversions.h b/extensions/scripting/lua-bindings/manual/LuaBasicConversions.h index 96bed530d9..adb0ac9482 100644 --- a/extensions/scripting/lua-bindings/manual/LuaBasicConversions.h +++ b/extensions/scripting/lua-bindings/manual/LuaBasicConversions.h @@ -92,19 +92,6 @@ extern bool luaval_is_usertype(lua_State* L,int lo,const char* type, int def); * @{ **/ - -/** - * Get a unsigned long value from the given acceptable index of stack. - * If the value at the given acceptable index of stack is a number or a string convertible to a number it returns true, otherwise returns false. - * - * @param L the current lua_State. - * @param lo the given acceptable index of stack. - * @param outValue the pointer to store the value converted from the Lua value. - * @param funcName the name of calling function, it is used for error output in the debug model. - * @return Return true if the value at the given acceptable index of stack is a number or a string convertible to a number, otherwise return false. - */ -extern bool luaval_to_ulong(lua_State* L,int lo, unsigned long* outValue, const char* funcName=""); - /** * Get a unsigned short value from the given acceptable index of stack. * If the value at the given acceptable index of stack is a number or a string convertible to a number it returns true, otherwise returns false. @@ -216,17 +203,6 @@ extern bool luaval_to_long_long(lua_State* L,int lo,long long* outValue, const c extern CC_LUA_DLL bool luaval_to_std_string(lua_State* L, int lo, std::string* outValue, const char* funcName = ""); extern CC_LUA_DLL bool luaval_to_std_string_view(lua_State* L, int lo, cxx17::string_view* outValue, const char* funcName = ""); -/** - * Get a long value from the given acceptable index of stack. - * If the value at the given acceptable index of stack is a number or a string convertible to a number it returns true, otherwise returns false. - * - * @param L the current lua_State. - * @param lo the given acceptable index of stack. - * @param outValue the pointer to store the long value converted from the Lua value. - * @param funcName the name of calling function, it is used for error output in the debug model. - * @return Return true if the value at the given acceptable index of stack is a number or a string convertible to a number, otherwise return false. - */ -extern bool luaval_to_long(lua_State* L,int lo, long* outValue, const char* funcName = ""); /** * Get a ssize_t value from the given acceptable index of stack. @@ -238,7 +214,7 @@ extern bool luaval_to_long(lua_State* L,int lo, long* outValue, const char* func * @param funcName the name of calling function, it is used for error output in the debug model. * @return Return true if the value at the given acceptable index of stack is a number or a string convertible to a number, otherwise return false. */ -extern bool luaval_to_ssize(lua_State* L,int lo, ssize_t* outValue, const char* funcName = ""); +extern bool luaval_to_ssize_t(lua_State* L,int lo, ssize_t* outValue, const char* funcName = ""); /** * Get a Size object value from the given acceptable index of stack. diff --git a/thirdparty/lua/tolua/tolua++.h b/thirdparty/lua/tolua/tolua++.h index e93a951a9b..88780ceaa0 100644 --- a/thirdparty/lua/tolua/tolua++.h +++ b/thirdparty/lua/tolua/tolua++.h @@ -144,6 +144,7 @@ TOLUA_API void tolua_add_value_to_root (lua_State* L,void* value); TOLUA_API void tolua_remove_value_from_root (lua_State* L, void* value); TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def); +TOLUA_API lua_Integer tolua_tointeger(lua_State* L, int narg, lua_Integer def); TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def); TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def); TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def); diff --git a/thirdparty/lua/tolua/tolua_to.c b/thirdparty/lua/tolua/tolua_to.c index eaff3980ac..0e7e641d52 100644 --- a/thirdparty/lua/tolua/tolua_to.c +++ b/thirdparty/lua/tolua/tolua_to.c @@ -82,6 +82,9 @@ TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def) { return lua_gettop(L)