From: Hwankyu Jhun Date: Tue, 27 Sep 2022 06:21:30 +0000 (+0000) Subject: Fix static analysis issues X-Git-Tag: accepted/tizen/unified/20220928.144436~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F10%2F282110%2F2;p=platform%2Fcore%2Fappfw%2Fcomponent-based-application.git Fix static analysis issues The following issues are fixed: - USE_AFTER_MOVE - ODR_VIOLATION - INEFFECTIVE_MOVE Change-Id: I65889d9dc572e8505e5968f7aaf251d8baa32b72 Signed-off-by: Hwankyu Jhun --- diff --git a/component_based/app_control/component_based_app_control.cc b/component_based/app_control/component_based_app_control.cc index afd88d8..470e052 100644 --- a/component_based/app_control/component_based_app_control.cc +++ b/component_based/app_control/component_based_app_control.cc @@ -40,8 +40,6 @@ AppControl::Impl::~Impl() { app_control_destroy(handle_); } -AppControl::Builder::~Builder() = default; - AppControl::Builder& AppControl::Builder::SetAppID(std::string appid) { appid_ = std::move(appid); return *this; @@ -70,7 +68,7 @@ AppControl::Builder& AppControl::Builder::AddExtra(std::string key, AppControl::Builder& AppControl::Builder::SetLaunchMode( AppControl::LaunchMode mode) { - mode_ = std::move(mode); + mode_ = mode; return *this; } diff --git a/component_based/app_control/component_based_app_control.h b/component_based/app_control/component_based_app_control.h index 8e1649e..a9de25c 100644 --- a/component_based/app_control/component_based_app_control.h +++ b/component_based/app_control/component_based_app_control.h @@ -71,7 +71,7 @@ class EXPORT_API AppControl { class Builder { public: - virtual ~Builder(); + virtual ~Builder() = default; Builder& SetAppID(std::string appid); Builder& SetOperation(std::string op); Builder& SetUri(Uri& uri); diff --git a/component_based/base/application_base.cc b/component_based/base/application_base.cc index db10b6a..d2072b6 100644 --- a/component_based/base/application_base.cc +++ b/component_based/base/application_base.cc @@ -282,8 +282,6 @@ ApplicationBase::ApplicationBase() : impl_(new Impl(this)) { } -ApplicationBase::~ApplicationBase() = default; - std::string ApplicationBase::GetApplicationID() { return impl_->GetApplicationID(); } diff --git a/component_based/base/application_base.h b/component_based/base/application_base.h index 2741465..be0d56e 100644 --- a/component_based/base/application_base.h +++ b/component_based/base/application_base.h @@ -35,7 +35,7 @@ namespace component_based { class EXPORT_API ApplicationBase : public tizen_cpp::AppCoreMultiWindowBase { public: ApplicationBase(); - virtual ~ApplicationBase(); + virtual ~ApplicationBase() = default; virtual std::map> OnCreateFactoryMap() = 0; diff --git a/component_based/base/component.cc b/component_based/base/component.cc index b75133e..d70228a 100644 --- a/component_based/base/component.cc +++ b/component_based/base/component.cc @@ -280,8 +280,6 @@ Component::Component(std::string comp_id, std::string inst_id, AppCoreMultiWindo impl_(new Impl(this)) { } -Component::~Component() = default; - void Component::Finish() { auto* app = GetApp(); auto* my_app = dynamic_cast(app); diff --git a/component_based/base/component.h b/component_based/base/component.h index 8ec0f63..1056cb4 100644 --- a/component_based/base/component.h +++ b/component_based/base/component.h @@ -59,7 +59,7 @@ class EXPORT_API Component : public tizen_cpp::AppCoreMultiWindowBase::Context, Component(std::string comp_id, std::string inst_id, tizen_cpp::AppCoreMultiWindowBase* app); - virtual ~Component(); + virtual ~Component() = default; virtual void OnDestroy(); void OnCreate() override; diff --git a/component_based/base/content_manager_internal.cc b/component_based/base/content_manager_internal.cc index f39cd87..5fc2061 100644 --- a/component_based/base/content_manager_internal.cc +++ b/component_based/base/content_manager_internal.cc @@ -36,8 +36,6 @@ ContentManager::ContentManager(std::string name) { file_ = std::unique_ptr(new File(path.GetPath(name))); } -ContentManager::~ContentManager() = default; - void ContentManager::SetContent(tizen_base::Bundle content) { auto raw = content.ToRaw(); uint8_t* p = reinterpret_cast(raw.first.get()); diff --git a/component_based/base/content_manager_internal.h b/component_based/base/content_manager_internal.h index 441ca90..b1f7990 100644 --- a/component_based/base/content_manager_internal.h +++ b/component_based/base/content_manager_internal.h @@ -33,7 +33,7 @@ namespace internal { class ContentManager { public: explicit ContentManager(std::string name); - virtual ~ContentManager(); + virtual ~ContentManager() = default; void SetContent(tizen_base::Bundle content); tizen_base::Bundle GetContent(); diff --git a/component_based/base/frame_component.cc b/component_based/base/frame_component.cc index 510e1dc..4013914 100644 --- a/component_based/base/frame_component.cc +++ b/component_based/base/frame_component.cc @@ -31,8 +31,6 @@ FrameComponent::FrameComponent(std::string comp_id, std::string inst_id, : Component::Component(std::move(comp_id), std::move(inst_id), app) { } -FrameComponent::~FrameComponent() = default; - FrameComponent::DisplayStatus FrameComponent::GetDisplayStatus() const { app_display_state_e state; int r = app_get_display_state(&state); diff --git a/component_based/base/frame_component.h b/component_based/base/frame_component.h index 911d4b3..e14f1f8 100644 --- a/component_based/base/frame_component.h +++ b/component_based/base/frame_component.h @@ -38,7 +38,7 @@ class EXPORT_API FrameComponent : public Component { FrameComponent(std::string comp_id, std::string inst_id, tizen_cpp::AppCoreMultiWindowBase* app); - virtual ~FrameComponent(); + virtual ~FrameComponent() = default; DisplayStatus GetDisplayStatus() const; const IWindow* GetWindow() const; diff --git a/component_based/base/service_component.cc b/component_based/base/service_component.cc index f9b9c6b..3f2725d 100644 --- a/component_based/base/service_component.cc +++ b/component_based/base/service_component.cc @@ -27,8 +27,6 @@ ServiceComponent::ServiceComponent(std::string comp_id, std::string inst_id, : Component::Component(std::move(comp_id), std::move(inst_id), app) { } -ServiceComponent::~ServiceComponent() = default; - void ServiceComponent::OnStart(AppControl control, bool restarted) { Component::OnStart(control, restarted); tizen_base::Bundle content = GetContent(); diff --git a/component_based/base/service_component.h b/component_based/base/service_component.h index 47737c7..667f994 100644 --- a/component_based/base/service_component.h +++ b/component_based/base/service_component.h @@ -31,7 +31,8 @@ class EXPORT_API ServiceComponent : public Component { public: ServiceComponent(std::string comp_id, std::string inst_id, tizen_cpp::AppCoreMultiWindowBase* app); - virtual ~ServiceComponent(); + virtual ~ServiceComponent() = default; + virtual void OnStartCommand(AppControl app_control, bool restarted); private: diff --git a/component_based/efl_base/application.cc b/component_based/efl_base/application.cc index 5af17ec..363cc06 100644 --- a/component_based/efl_base/application.cc +++ b/component_based/efl_base/application.cc @@ -32,8 +32,6 @@ namespace component_based { Application::Application() { } -Application::~Application() = default; - void Application::OnLoopInit(int argc, char** argv) { LOGD(""); elm_init(argc, argv); diff --git a/component_based/efl_base/application.h b/component_based/efl_base/application.h index 4847b11..247bd7c 100644 --- a/component_based/efl_base/application.h +++ b/component_based/efl_base/application.h @@ -31,7 +31,7 @@ namespace component_based { class EXPORT_API Application : public ApplicationBase { public: Application(); - virtual ~Application(); + virtual ~Application() = default; std::map> OnCreateFactoryMap() override; diff --git a/component_based/port/peer_creds.cc b/component_based/port/peer_creds.cc index 22850d1..0da9395 100644 --- a/component_based/port/peer_creds.cc +++ b/component_based/port/peer_creds.cc @@ -33,8 +33,6 @@ PeerCreds::PeerCreds(pid_t pid, std::string user, std::string client, session_(std::move(session)) { } -PeerCreds::~PeerCreds() = default; - pid_t PeerCreds::GetPid() const { return pid_; } diff --git a/component_based/port/peer_creds.hh b/component_based/port/peer_creds.hh index fb70d4d..8a993f4 100644 --- a/component_based/port/peer_creds.hh +++ b/component_based/port/peer_creds.hh @@ -27,7 +27,7 @@ class PeerCreds { public: PeerCreds(pid_t pid, std::string user, std::string client, std::string session); - virtual ~PeerCreds(); + virtual ~PeerCreds() = default; pid_t GetPid() const; const std::string& GetUser() const; diff --git a/component_based/port/request.cc b/component_based/port/request.cc index 941d21a..2dcc41f 100644 --- a/component_based/port/request.cc +++ b/component_based/port/request.cc @@ -25,10 +25,6 @@ Request::Request(std::string sender, bool sync, std::vector data) : sender_(std::move(sender)), sync_(sync), data_(std::move(data)) { } -Request::Request() = default; - -Request::~Request() = default; - void Request::WriteToParcel(tizen_base::Parcel* parcel) const { parcel->WriteString(sender_); parcel->WriteBool(sync_); diff --git a/component_based/port/request.hh b/component_based/port/request.hh index cb3589c..ed3baf4 100644 --- a/component_based/port/request.hh +++ b/component_based/port/request.hh @@ -28,8 +28,8 @@ namespace component_based { class Request : public tizen_base::Parcelable { public: Request(std::string sender, bool sync, std::vector data); - Request(); - virtual ~Request(); + Request() = default; + virtual ~Request() = default; void WriteToParcel(tizen_base::Parcel* parcel) const override; void ReadFromParcel(tizen_base::Parcel* parcel) override; diff --git a/component_based/port/response.cc b/component_based/port/response.cc index ca4ed4f..d90a550 100644 --- a/component_based/port/response.cc +++ b/component_based/port/response.cc @@ -25,10 +25,6 @@ Response::Response(int32_t result, std::vector data) : result_(result), data_(std::move(data)) { } -Response::Response() = default; - -Response::~Response() = default; - void Response::WriteToParcel(tizen_base::Parcel* parcel) const { parcel->WriteInt32(result_); parcel->WriteUInt32(data_.size()); diff --git a/component_based/port/response.hh b/component_based/port/response.hh index 9c8bdac..490c570 100644 --- a/component_based/port/response.hh +++ b/component_based/port/response.hh @@ -28,8 +28,8 @@ namespace component_based { class Response : public tizen_base::Parcelable { public: Response(int32_t result, std::vector data); - Response(); - virtual ~Response(); + Response() = default; + virtual ~Response() = default; void WriteToParcel(tizen_base::Parcel* parcel) const override; void ReadFromParcel(tizen_base::Parcel* parcel) override; diff --git a/component_based/port/sender_info.cc b/component_based/port/sender_info.cc index fdd1025..46aa020 100644 --- a/component_based/port/sender_info.cc +++ b/component_based/port/sender_info.cc @@ -22,8 +22,6 @@ SenderInfo::SenderInfo(std::string name, pid_t pid) : name_(std::move(name)), pid_(pid) { } -SenderInfo::~SenderInfo() = default; - const std::string& SenderInfo::GetName() const { return name_; } diff --git a/component_based/port/sender_info.hh b/component_based/port/sender_info.hh index 44c1152..f3af1a4 100644 --- a/component_based/port/sender_info.hh +++ b/component_based/port/sender_info.hh @@ -26,7 +26,7 @@ namespace component_based { class EXPORT_API SenderInfo { public: SenderInfo(std::string name, pid_t pid); - virtual ~SenderInfo(); + virtual ~SenderInfo() = default; const std::string& GetName() const; pid_t GetPid() const; diff --git a/component_based/uri/component_based_uri.cc b/component_based/uri/component_based_uri.cc index e8234f5..f5dfaf2 100644 --- a/component_based/uri/component_based_uri.cc +++ b/component_based/uri/component_based_uri.cc @@ -23,8 +23,6 @@ namespace component_based { -Uri::Builder::~Builder() = default; - Uri::Builder& Uri::Builder::SetScheme(std::string scheme) { scheme_ = std::move(scheme); return *this; @@ -79,9 +77,6 @@ Uri::Uri(std::string scheme, std::string auth, ParseAuthoritySubComponent(auth_); } -Uri::Uri() = default; -Uri::~Uri() = default; - const std::string& Uri::GetScheme() const { return scheme_; } diff --git a/component_based/uri/component_based_uri.h b/component_based/uri/component_based_uri.h index 39446be..6d2df46 100644 --- a/component_based/uri/component_based_uri.h +++ b/component_based/uri/component_based_uri.h @@ -33,7 +33,7 @@ class EXPORT_API Uri { public: class Builder { public: - virtual ~Builder(); + virtual ~Builder() = default; Builder& SetScheme(std::string scheme); Builder& SetAuthority(std::string auth); Builder& SetPath(std::string path); @@ -50,12 +50,12 @@ class EXPORT_API Uri { std::list query_list_; }; - Uri(); + Uri() = default; explicit Uri(std::string encoded_uri); Uri(std::string scheme, std::string auth, std::string path, std::list query, std::string fragment); - virtual ~Uri(); + virtual ~Uri() = default; const std::string& GetScheme() const; const std::string& GetAuthority() const; diff --git a/test/unit_tests/test_component_based_app_control.cc b/test/unit_tests/test_component_based_app_control.cc index ea9bc82..5a7e259 100644 --- a/test/unit_tests/test_component_based_app_control.cc +++ b/test/unit_tests/test_component_based_app_control.cc @@ -76,6 +76,6 @@ TEST_F(AppControlTest, AppControl_Constructor) { component_based::AppControl ctrl1(ctrl); ctrl1 = ctrl; - component_based::AppControl ctrl3(std::move(ctrl)); + component_based::AppControl ctrl3(std::move(ctrl1)); ctrl3 = std::move(ctrl); }