From a39b2e87db08fc506280ebab5f2d923832f4f9b2 Mon Sep 17 00:00:00 2001 From: halx99 Date: Wed, 24 Jul 2024 00:09:10 +0800 Subject: [PATCH] Fix some ci warnings --- .../Source/DrawNodeExTest/DrawNodeExTest.h | 24 +++++++++---------- .../MeshRendererTest/MeshRendererTest.cpp | 2 +- .../WebSocketTest/WebSocketTest.cpp | 12 +++++----- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/cpp-tests/Source/DrawNodeExTest/DrawNodeExTest.h b/tests/cpp-tests/Source/DrawNodeExTest/DrawNodeExTest.h index ec7279dbc533..23eca2c3e5fa 100644 --- a/tests/cpp-tests/Source/DrawNodeExTest/DrawNodeExTest.h +++ b/tests/cpp-tests/Source/DrawNodeExTest/DrawNodeExTest.h @@ -47,7 +47,7 @@ class DrawNodePictureTest : public DrawNodeExBaseTest virtual std::string title() const override; virtual std::string subtitle() const override; - void update(float dt); + void update(float dt) override; private: ax::extension::DrawNodeEx* drawNodeEx; @@ -63,7 +63,7 @@ class DrawNodeMorphTest : public DrawNodeExBaseTest virtual std::string title() const override; virtual std::string subtitle() const override; - void update(float dt); + void update(float dt) override; private: ax::extension::DrawNodeEx* drawNodeEx; @@ -96,7 +96,7 @@ class DrawNodeFireworkTest : public DrawNodeExBaseTest virtual std::string title() const override; virtual std::string subtitle() const override; - void update(float dt); + void update(float dt) override; fireObj* createFireObjs(int count); @@ -174,7 +174,7 @@ class DrawNodeThicknessTest : public DrawNodeExBaseTest virtual std::string title() const override; virtual std::string subtitle() const override; - void update(float dt); + void update(float dt) override; void initSliders(); void changeThickness(ax::Object* pSender, ax::ui::Slider::EventType type); @@ -198,7 +198,7 @@ class DrawNodeVersionsTest : public DrawNodeExBaseTest virtual std::string title() const override; virtual std::string subtitle() const override; - void update(float dt); + void update(float dt) override; private: ax::extension::DrawNodeEx* drawNodeEx; @@ -225,7 +225,7 @@ class DrawNodePieTest : public DrawNodeExBaseTest virtual std::string title() const override; virtual std::string subtitle() const override; - void update(float dt); + void update(float dt) override; void initSliders(); void changeStartAngle(ax::Object* pSender, ax::ui::Slider::EventType type); @@ -254,7 +254,7 @@ class DrawNodeMethodesTest : public DrawNodeExBaseTest virtual std::string title() const override; virtual std::string subtitle() const override; - void update(float dt); + void update(float dt) override; void sliderCallback(ax::Object* sender, ax::ui::Slider::EventType type); void listviewCallback(ax::Object* sender, ax::ui::ListView::EventType type); @@ -288,7 +288,7 @@ class DrawNodePerformaneTest : public DrawNodeExBaseTest virtual std::string title() const override; virtual std::string subtitle() const override; - void update(float dt); + void update(float dt) override; void sliderCallback(ax::Object* sender, ax::ui::Slider::EventType type); void listviewCallback(ax::Object* sender, ax::ui::ListView::EventType type); @@ -319,7 +319,7 @@ class DrawNodeHeartTest : public DrawNodeExBaseTest virtual std::string title() const override; virtual std::string subtitle() const override; - void update(float dt); + void update(float dt) override; private: ax::extension::DrawNodeEx* drawNodeEx; @@ -338,7 +338,7 @@ class DrawNodeDrawInWrongOrder_Issue1888 : public DrawNodeExBaseTest virtual std::string title() const override; virtual std::string subtitle() const override; - void update(float dt); + void update(float dt) override; private: ax::extension::DrawNodeEx* drawNodeEx; @@ -380,7 +380,7 @@ class DrawNodeCocos2dxBetterCircleRendering : public DrawNodeExBaseTest virtual std::string title() const override; virtual std::string subtitle() const override; - void update(float dt); + void update(float dt) override; void initSliders(); void changeThreshold(Object* pSender, ax::ui::Slider::EventType type); @@ -426,7 +426,7 @@ class DrawNodeCocos2dxDrawNodePieTest : public DrawNodeExBaseTest virtual std::string title() const override; virtual std::string subtitle() const override; - void update(float dt); + void update(float dt) override; void initSliders(); void changeStartAngle(Object* pSender, ax::ui::Slider::EventType type); diff --git a/tests/cpp-tests/Source/MeshRendererTest/MeshRendererTest.cpp b/tests/cpp-tests/Source/MeshRendererTest/MeshRendererTest.cpp index 78568f4786ba..403dfc1a6539 100644 --- a/tests/cpp-tests/Source/MeshRendererTest/MeshRendererTest.cpp +++ b/tests/cpp-tests/Source/MeshRendererTest/MeshRendererTest.cpp @@ -1037,7 +1037,7 @@ void AsyncLoadMeshRendererTest::menuCallback_asyncLoadMesh(Object* sender) int32_t index = 0; for (const auto& path : _paths) { - MeshRenderer::createAsync(path, AX_CALLBACK_2(AsyncLoadMeshRendererTest::asyncLoad_Callback, this), (void*)index++); + MeshRenderer::createAsync(path, AX_CALLBACK_2(AsyncLoadMeshRendererTest::asyncLoad_Callback, this), reinterpret_cast(static_cast(++index))); } } diff --git a/tests/cpp-tests/Source/NetworkTest/WebSocketTest/WebSocketTest.cpp b/tests/cpp-tests/Source/NetworkTest/WebSocketTest/WebSocketTest.cpp index d90ac1250a1c..87a3d56cc9fb 100644 --- a/tests/cpp-tests/Source/NetworkTest/WebSocketTest/WebSocketTest.cpp +++ b/tests/cpp-tests/Source/NetworkTest/WebSocketTest/WebSocketTest.cpp @@ -189,7 +189,7 @@ void WebSocketTest::startTestCallback(Object* sender) void WebSocketTest::onOpen(network::WebSocket* ws) { char status[256] = {0}; - sprintf(status, "Opened, url: %s, protocol: %s", ws->getUrl().data(), ws->getProtocol().data()); + fmt::format_to(status, "Opened, url: {}, protocol: {}", ws->getUrl(), ws->getProtocol()); AXLOGI("Websocket ({}) was opened, url: {}, protocol: {}", fmt::ptr(ws), ws->getUrl(), ws->getProtocol()); if (ws == _wsiSendText) @@ -221,7 +221,7 @@ void WebSocketTest::onMessage(network::WebSocket* ws, const network::WebSocket:: { _sendBinaryTimes++; char times[100] = {0}; - sprintf(times, "%d", _sendBinaryTimes); + fmt::format_to(times, "{}", _sendBinaryTimes); std::string binaryStr = "response bin msg: "; @@ -271,7 +271,7 @@ void WebSocketTest::onError(network::WebSocket* ws, const network::WebSocket::Er { AXLOGD("Error was fired, error code: {}", static_cast(error)); char buf[100] = {0}; - sprintf(buf, "An error was fired, code: %s", static_cast(error)); + fmt::format_to(buf, "An error was fired, code: {}", static_cast(error)); if (ws == _wsiSendText) { @@ -521,7 +521,7 @@ void WebSocketDelayTest::doReceiveText() void WebSocketDelayTest::onOpen(network::WebSocket* ws) { char status[256] = {0}; - sprintf(status, "Opened, url: %s, protocol: %s", ws->getUrl(), ws->getProtocol()); + fmt::format_to(status, "Opened, url: {}, protocol: {}", ws->getUrl(), ws->getProtocol()); AXLOGD("Websocket ({}) was opened, url: {}, protocol: {}", fmt::ptr(ws), ws->getUrl(), ws->getProtocol()); if (ws == _wsiSendText) @@ -536,7 +536,7 @@ void WebSocketDelayTest::onMessage(network::WebSocket* ws, const network::WebSoc { _receiveTextTimes++; char times[100] = {0}; - sprintf(times, "%d", _receiveTextTimes); + fmt::format_to(times, "{}", _receiveTextTimes); std::string textStr = std::string("response text msg: ") + data.bytes + ", " + times; AXLOGD("{}", textStr); doReceiveText(); @@ -563,7 +563,7 @@ void WebSocketDelayTest::onError(network::WebSocket* ws, const network::WebSocke { AXLOGD("Error was fired, error code: {}", static_cast(error)); char buf[100] = {0}; - sprintf(buf, "An error was fired, code: %d", static_cast(error)); + fmt::format_to(buf, "An error was fired, code: {}", static_cast(error)); if (ws == _wsiSendText) {