Use explicit cast to uintptr_t prior to casting to int type.

This commit is contained in:
rh101 2021-09-02 16:52:40 +10:00
parent 546d7d6c61
commit 60c0a58cfd
1 changed files with 2 additions and 2 deletions

View File

@ -893,7 +893,7 @@ void AsyncLoadSprite3DTest::menuCallback_asyncLoadSprite(Ref* sender)
void AsyncLoadSprite3DTest::asyncLoad_Callback(Sprite3D* sprite, void* param) void AsyncLoadSprite3DTest::asyncLoad_Callback(Sprite3D* sprite, void* param)
{ {
auto index = (long)param; auto index = static_cast<int>((uintptr_t)param));
auto node = getChildByTag(101); auto node = getChildByTag(101);
auto s = Director::getInstance()->getWinSize(); auto s = Director::getInstance()->getWinSize();
float width = s.width / _paths.size(); float width = s.width / _paths.size();
@ -1324,7 +1324,7 @@ Sprite3DReskinTest::Sprite3DReskinTest()
} }
void Sprite3DReskinTest::menuCallback_reSkin(Ref* sender) void Sprite3DReskinTest::menuCallback_reSkin(Ref* sender)
{ {
auto index = (long)(((MenuItemLabel*)sender)->getUserData()); auto index = static_cast<int>((uintptr_t)(((MenuItemLabel*)sender)->getUserData()));
if (index < (int)SkinType::MAX_TYPE) if (index < (int)SkinType::MAX_TYPE)
{ {
_curSkin[index] = (_curSkin[index] + 1) % _skins[index].size(); _curSkin[index] = (_curSkin[index] + 1) % _skins[index].size();