diff --git a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp index a8ca9c8e29..1b86e03172 100644 --- a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp +++ b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp @@ -773,7 +773,7 @@ void ActionSequence2::callback2(Node* sender) addChild(label); } -void ActionSequence2::callback3(Node* sender, long data) +void ActionSequence2::callback3(Node* sender, int32_t data) { auto s = Director::getInstance()->getWinSize(); auto label = Label::createWithTTF("callback 3 called", "fonts/Marker Felt.ttf", 16.0f); @@ -950,7 +950,7 @@ void ActionCallFunction::callback2(Node* sender) CCLOG("sender is: %p", sender); } -void ActionCallFunction::callback3(Node* sender, long data) +void ActionCallFunction::callback3(Node* sender, int32_t data) { auto s = Director::getInstance()->getWinSize(); auto label = Label::createWithTTF("callback 3 called", "fonts/Marker Felt.ttf", 16.0f); diff --git a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.h b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.h index e83a6b94f4..12b16ed6a1 100644 --- a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.h +++ b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.h @@ -205,7 +205,7 @@ public: void callback1(); void callback2(Node* sender); - void callback3(Node* sender, long data); + void callback3(Node* sender, int32_t data); }; class ActionSequence3 : public ActionsDemo @@ -351,7 +351,7 @@ public: void callback1(); void callback2(Node* pTarget); - void callback3(Node* pTarget, long data); + void callback3(Node* pTarget, int32_t data); }; diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-14327.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-14327.cpp index 10d07ef80c..a5f56f5751 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-14327.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-14327.cpp @@ -75,7 +75,7 @@ bool Bug14327Layer::init() void Bug14327Layer::update(float dt) { - long delta = _removeTime - time(nullptr); + int32_t delta = _removeTime - time(nullptr); if (delta > 0) { ldiv_t ret = ldiv(delta, 60L); diff --git a/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp b/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp index e9961f616e..9f03e2456d 100644 --- a/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp +++ b/tests/cpp-tests/Classes/Camera3DTest/Camera3DTest.cpp @@ -900,7 +900,7 @@ void CameraCullingDemo::addSpriteCallback(Ref* sender) // update sprite number char szText[16]; - sprintf(szText,"%ld sprits", static_cast(_layer3D->getChildrenCount())); + sprintf(szText,"%ld sprits", static_cast(_layer3D->getChildrenCount())); _labelSprite3DCount->setString(szText); } @@ -928,7 +928,7 @@ void CameraCullingDemo::delSpriteCallback(Ref* sender) // update sprite number char szText[16]; - sprintf(szText,"%ld sprits", static_cast(_layer3D->getChildrenCount())); + sprintf(szText,"%ld sprits", static_cast(_layer3D->getChildrenCount())); _labelSprite3DCount->setString(szText); } diff --git a/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp index 144595032e..6db8a02f3c 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp @@ -71,7 +71,7 @@ bool TableViewTest::init() void TableViewTest::tableCellTouched(TableView* table, TableViewCell* cell) { - CCLOG("cell touched at index: %ld", static_cast(cell->getIdx())); + CCLOG("cell touched at index: %ld", static_cast(cell->getIdx())); } Size TableViewTest::tableCellSizeForIndex(TableView *table, ssize_t idx) @@ -84,7 +84,7 @@ Size TableViewTest::tableCellSizeForIndex(TableView *table, ssize_t idx) TableViewCell* TableViewTest::tableCellAtIndex(TableView *table, ssize_t idx) { - auto string = StringUtils::format("%ld", static_cast(idx)); + auto string = StringUtils::format("%ld", static_cast(idx)); TableViewCell *cell = table->dequeueCell(); if (!cell) { cell = new (std::nothrow) CustomTableViewCell(); diff --git a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp index f6a81d9803..a16ff5af97 100644 --- a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp +++ b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp @@ -373,7 +373,7 @@ void TestFileFuncs::onEnter() this->addChild(label); // getFileSize Test - long size = sharedFileUtils->getFileSize(filepath); + int32_t size = sharedFileUtils->getFileSize(filepath); msg = StringUtils::format("getFileSize: Test file size equals %ld", size); label = Label::createWithSystemFont(msg, "", 20); label->setPosition(x, y * 3); @@ -1160,7 +1160,7 @@ void TestFileFuncsAsync::onEnter() label->setPosition(x, y * 4); this->addChild(label); - sharedFileUtils->getFileSize(filepath, [=](long size) { + sharedFileUtils->getFileSize(filepath, [=](int32_t size) { auto msg = StringUtils::format("getFileSize: Test file size equals %ld", size); auto label = Label::createWithSystemFont(msg, "", 20); label->setPosition(x, y * 3); diff --git a/tests/cpp-tests/Classes/NetworkTest/HttpClientTest/HttpClientTest.cpp b/tests/cpp-tests/Classes/NetworkTest/HttpClientTest/HttpClientTest.cpp index eccd33d7ba..0494cf5281 100644 --- a/tests/cpp-tests/Classes/NetworkTest/HttpClientTest/HttpClientTest.cpp +++ b/tests/cpp-tests/Classes/NetworkTest/HttpClientTest/HttpClientTest.cpp @@ -311,7 +311,7 @@ void HttpClientTest::onHttpRequestCompleted(HttpClient *sender, HttpResponse *re log("%s completed", response->getHttpRequest()->getTag()); } - long statusCode = response->getResponseCode(); + int32_t statusCode = response->getResponseCode(); char statusString[64] = {}; sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag()); _labelStatusCode->setString(statusString); @@ -460,7 +460,7 @@ void HttpClientClearRequestsTest::onHttpRequestCompleted(HttpClient *sender, Htt log("%s completed", response->getHttpRequest()->getTag()); } - long statusCode = response->getResponseCode(); + int32_t statusCode = response->getResponseCode(); char statusString[64] = {}; sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag()); _labelStatusCode->setString(statusString); diff --git a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp index 02fb1d237b..3ce4a440e3 100644 --- a/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp +++ b/tests/cpp-tests/Classes/Sprite3DTest/Sprite3DTest.cpp @@ -885,7 +885,7 @@ void AsyncLoadSprite3DTest::menuCallback_asyncLoadSprite(Ref* sender) //remove cache data Sprite3DCache::getInstance()->removeAllSprite3DData(); - long index = 0; + int32_t index = 0; for (const auto& path : _paths) { Sprite3D::createAsync(path, CC_CALLBACK_2(AsyncLoadSprite3DTest::asyncLoad_Callback, this), (void*)index++); } @@ -893,7 +893,7 @@ void AsyncLoadSprite3DTest::menuCallback_asyncLoadSprite(Ref* sender) void AsyncLoadSprite3DTest::asyncLoad_Callback(Sprite3D* sprite, void* param) { - long index = (long)param; + auto index = (int32_t)param; auto node = getChildByTag(101); auto s = Director::getInstance()->getWinSize(); float width = s.width / _paths.size(); @@ -1324,7 +1324,7 @@ Sprite3DReskinTest::Sprite3DReskinTest() } void Sprite3DReskinTest::menuCallback_reSkin(Ref* sender) { - long index = (long)(((MenuItemLabel*)sender)->getUserData()); + auto index = (int32_t)(((MenuItemLabel*)sender)->getUserData()); if (index < (int)SkinType::MAX_TYPE) { _curSkin[index] = (_curSkin[index] + 1) % _skins[index].size(); @@ -1506,7 +1506,7 @@ void Sprite3DWithOBBPerformanceTest::onTouchesMoved(const std::vector& t void Sprite3DWithOBBPerformanceTest::update(float dt) { char szText[16]; - sprintf(szText, "%lu cubes", static_cast(_obb.size())); + sprintf(szText, "%lu cubes", static_cast(_obb.size())); _labelCubeCount->setString(szText); if (_drawDebug) diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp index 8897df3bbf..18e62bb436 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp @@ -129,7 +129,7 @@ void UIPageViewTest::pageViewEvent(Ref *pSender, PageView::EventType type) { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); + _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); } break; @@ -241,7 +241,7 @@ void UIPageViewButtonTest::pageViewEvent(Ref *pSender, PageView::EventType type) { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); + _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); } break; @@ -438,7 +438,7 @@ void UIPageViewTouchPropagationTest::pageViewEvent(Ref *pSender, PageView::Event { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); + _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); } break; @@ -558,7 +558,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init() } pageView->pushBackCustomItem(outerBox); - _displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast(pageView->getItems().size()))); + _displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast(pageView->getItems().size()))); CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); _uiLayer->addChild(button); @@ -579,7 +579,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init() { CCLOG("There is no page to remove!"); } - _displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast(pageView->getItems().size()))); + _displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast(pageView->getItems().size()))); CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); @@ -594,7 +594,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init() button3->addClickEventListener([=](Ref* sender) { pageView->removeAllItems(); - _displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast(pageView->getItems().size()))); + _displayValueLabel->setString(StringUtils::format("page count = %ld", static_cast(pageView->getItems().size()))); CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); @@ -623,7 +623,7 @@ void UIPageViewDynamicAddAndRemoveTest::pageViewEvent(Ref *pSender, PageView::Ev { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast((pageView->getCurrentPageIndex() + 1)))); + _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast((pageView->getCurrentPageIndex() + 1)))); } break; @@ -825,7 +825,7 @@ void UIPageViewVerticalTest::pageViewEvent(Ref *pSender, PageView::EventType typ { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); + _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); } break; @@ -984,7 +984,7 @@ void UIPageViewChildSizeTest::pageViewEvent(Ref *pSender, PageView::EventType ty { PageView* pageView = dynamic_cast(pSender); - _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); + _displayValueLabel->setString(StringUtils::format("page = %ld", static_cast(pageView->getCurrentPageIndex() + 1))); } break; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp index 40d546abb5..2def10a868 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp @@ -69,12 +69,12 @@ bool UIRichTextTest::init() std::string str2 = config->getValue("Japanese").asString(); CCLOG("str1:%s ascii length = %ld, utf8 length = %ld, substr = %s", str1.c_str(), - static_cast(str1.length()), + static_cast(str1.length()), StringUtils::getCharacterCountInUTF8String(str1), Helper::getSubStringOfUTF8String(str1, 0, 5).c_str()); CCLOG("str2:%s ascii length = %ld, utf8 length = %ld, substr = %s", str2.c_str(), - static_cast(str2.length()), + static_cast(str2.length()), StringUtils::getCharacterCountInUTF8String(str2), Helper::getSubStringOfUTF8String(str2, 0, 2).c_str()); diff --git a/tests/cpp-tests/Classes/controller.cpp b/tests/cpp-tests/Classes/controller.cpp index 9f991eec05..7e0647b1b2 100644 --- a/tests/cpp-tests/Classes/controller.cpp +++ b/tests/cpp-tests/Classes/controller.cpp @@ -494,7 +494,7 @@ bool TestController::blockTouchBegan(Touch* touch, Event* event) #if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 #include -static long __stdcall windowExceptionFilter(_EXCEPTION_POINTERS* excp) +static int32_t __stdcall windowExceptionFilter(_EXCEPTION_POINTERS* excp) { if (s_testController) {