From: Inkyun Kil Date: Tue, 26 Sep 2023 01:08:38 +0000 (+0900) Subject: Fix static analysis issues X-Git-Tag: accepted/tizen/unified/20231024.032158~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3828293c2a3ef5fdea29ed8e123f3f8abeb573ec;p=platform%2Fcore%2Fappfw%2Fwidget-viewer.git Fix static analysis issues Change-Id: Ib203e23a8be1d9ef9777ea434e5f83f818e272b4 Signed-off-by: Inkyun Kil --- diff --git a/ambient-viewer/src/util.cc b/ambient-viewer/src/util.cc index 742ed529..e8b51a14 100644 --- a/ambient-viewer/src/util.cc +++ b/ambient-viewer/src/util.cc @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include #include "util.hh" @@ -38,7 +39,8 @@ float GetOpr(void* source_data, int width, int height) { float max_opr; bool shape_circle = false; - system_info_get_platform_bool(KEY_SCREEN_SHAPE_CIRCLE, &shape_circle);; + if (system_info_get_platform_bool(KEY_SCREEN_SHAPE_CIRCLE, &shape_circle)) + LOGE("Failed to get system info"); source = static_cast(source_data); pos = width / 2; diff --git a/tests/unit_tests/src/test_ambient_viewer.cc b/tests/unit_tests/src/test_ambient_viewer.cc index 31a9286f..61d25766 100644 --- a/tests/unit_tests/src/test_ambient_viewer.cc +++ b/tests/unit_tests/src/test_ambient_viewer.cc @@ -227,7 +227,7 @@ class Mocks : public ::testing::NiceMock, class AmbientViewerTest : public TestFixture { public: AmbientViewerTest() : TestFixture(std::make_unique()) {} - AmbientViewerStub* stub; + AmbientViewerStub* stub = nullptr; virtual void SetUp() { EXPECT_CALL(GetMock(), vconf_get_str(_)) @@ -268,19 +268,19 @@ TEST_F(AmbientViewerTest, create) { TEST_F(AmbientViewerTest, NotifyAmbientEvent) { Bundle b; EXPECT_EQ(AmbientViewerTest::stub->NotifyAmbientEvent(AmbientViewer::AMBIENT_ENTER, - AmbientViewer::DIRECTION_ALL, b), 0); + AmbientViewer::DIRECTION_ALL, std::move(b)), 0); } TEST_F(AmbientViewerTest, NotifyAmbientEvent2) { Bundle b; EXPECT_EQ(AmbientViewerTest::stub->NotifyAmbientEvent(AmbientViewer::AMBIENT_ENTER, - AmbientViewer::DIRECTION_VIEWER_AND_WATCH, b), 0); + AmbientViewer::DIRECTION_VIEWER_AND_WATCH, std::move(b)), 0); } TEST_F(AmbientViewerTest, NotifyAmbientEvent3) { Bundle b; EXPECT_EQ(AmbientViewerTest::stub->NotifyAmbientEvent(AmbientViewer::AMBIENT_ENTER, - AmbientViewer::DIRECTION_VIEWER_AND_TOP_APP, b), 0); + AmbientViewer::DIRECTION_VIEWER_AND_TOP_APP, std::move(b)), 0); } TEST_F(AmbientViewerTest, BlockUpdate) { diff --git a/tests/unit_tests/src/test_watch_holder.cc b/tests/unit_tests/src/test_watch_holder.cc index 58417979..3389d458 100644 --- a/tests/unit_tests/src/test_watch_holder.cc +++ b/tests/unit_tests/src/test_watch_holder.cc @@ -47,7 +47,7 @@ class WatchHolderStub : public WatchHolder { } void InvokeAmbientEvent(EventType ev, string sender, Bundle extra) { - OnAmbientEvent(ev, sender, extra); + OnAmbientEvent(ev, std::move(sender), std::move(extra)); } void OnAdded(const WatchBase& watch) override {} void OnUpdated(const WatchBase& watch) override {} @@ -58,12 +58,13 @@ class WatchHolderStub : public WatchHolder { std::shared_ptr CreateWatch(int rid, std::string id, std::string appid, bool mock) override { - return WatchHolder::CreateWatch(rid, id, appid, true); + return WatchHolder::CreateWatch(rid, std::move(id), std::move(appid), true); } std::shared_ptr CreateWatch(int rid, std::string id, std::string appid, tizen_base::Bundle extra, bool mock) override { - return WatchHolder::CreateWatch(rid, id, appid, extra, true); + return WatchHolder::CreateWatch(rid, std::move(id), std::move(appid), + std::move(extra), true); } }; @@ -118,7 +119,7 @@ class WatchHolderTest : public TestFixture { public: WatchHolderTest() : TestFixture(std::make_unique()) {} virtual ~WatchHolderTest() {} - WatchHolderStub* stub; + WatchHolderStub* stub = nullptr; virtual void SetUp() { EXPECT_CALL(GetMock(), aul_app_com_create(_, _, _, _, _))