Fix static analysis issues 10/282110/2
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 27 Sep 2022 06:21:30 +0000 (06:21 +0000)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 27 Sep 2022 06:33:26 +0000 (06:33 +0000)
The following issues are fixed:
 - USE_AFTER_MOVE
 - ODR_VIOLATION
 - INEFFECTIVE_MOVE

Change-Id: I65889d9dc572e8505e5968f7aaf251d8baa32b72
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
25 files changed:
component_based/app_control/component_based_app_control.cc
component_based/app_control/component_based_app_control.h
component_based/base/application_base.cc
component_based/base/application_base.h
component_based/base/component.cc
component_based/base/component.h
component_based/base/content_manager_internal.cc
component_based/base/content_manager_internal.h
component_based/base/frame_component.cc
component_based/base/frame_component.h
component_based/base/service_component.cc
component_based/base/service_component.h
component_based/efl_base/application.cc
component_based/efl_base/application.h
component_based/port/peer_creds.cc
component_based/port/peer_creds.hh
component_based/port/request.cc
component_based/port/request.hh
component_based/port/response.cc
component_based/port/response.hh
component_based/port/sender_info.cc
component_based/port/sender_info.hh
component_based/uri/component_based_uri.cc
component_based/uri/component_based_uri.h
test/unit_tests/test_component_based_app_control.cc

index afd88d8d161bf2317954643b4a23e556b4103683..470e05231b386254982b7980163f08ceb186bcc4 100644 (file)
@@ -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;
 }
 
index 8e1649e632c5efa7c940b45d621febd9daac1a29..a9de25cc0d717652b0a192a66384569d031f807c 100644 (file)
@@ -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);
index db10b6a7749866ea5a595d6db274a9bcc61d9f06..d2072b68c7648b273489f43ef5c35510880e3b56 100644 (file)
@@ -282,8 +282,6 @@ ApplicationBase::ApplicationBase()
   : impl_(new Impl(this)) {
 }
 
-ApplicationBase::~ApplicationBase() = default;
-
 std::string ApplicationBase::GetApplicationID() {
   return impl_->GetApplicationID();
 }
index 2741465d87648e0fd6a885844660745b7cf880bb..be0d56e7f8484bbb68df1d4b79195f39dbefd483 100644 (file)
@@ -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<std::string, std::unique_ptr<Component::FactoryBase>>
       OnCreateFactoryMap() = 0;
index b75133e0e0c190de6ebbb241a61a23f8a64f5d9c..d70228a1b0fb7efbb31393bfc79032a5d3f9b0b3 100644 (file)
@@ -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<ApplicationBase*>(app);
index 8ec0f633657137009d2c622e96d9f5f89d5ae962..1056cb4712276b6eeb414f655dd1326447a5c01b 100644 (file)
@@ -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;
index f39cd87decfd42f48111ece42a1520c89ca28471..5fc206165bc24991933c7f558226e8a3fe285764 100644 (file)
@@ -36,8 +36,6 @@ ContentManager::ContentManager(std::string name) {
   file_ = std::unique_ptr<File>(new File(path.GetPath(name)));
 }
 
-ContentManager::~ContentManager() = default;
-
 void ContentManager::SetContent(tizen_base::Bundle content) {
   auto raw = content.ToRaw();
   uint8_t* p = reinterpret_cast<uint8_t*>(raw.first.get());
index 441ca90922775f7514856fdb93966cac48db48c2..b1f7990490c7282c0e96ad445700105b182d6959 100644 (file)
@@ -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();
index 510e1dcfdf11ae9d41429706f6411728df930fa9..4013914d8bb4dc9e4f721464912294c49ee76df2 100644 (file)
@@ -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);
index 911d4b36e826c880203c257b76cb9f3de9521adb..e14f1f84d32c96160d0d74dac43417edd427e1a4 100644 (file)
@@ -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;
index f9b9c6b7c5a0834807750e6d68eaba7a2b92d5d7..3f2725d3cfadab2fe918fa9a2fd6bb6cc630576a 100644 (file)
@@ -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();
index 47737c78536917e930d6af0e614dbbe6a90654d6..667f9949f971ff1593f7eddb672fb9d846fb18b7 100644 (file)
@@ -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:
index 5af17ec29e94452eeb8ca291fb8e25c47040d8db..363cc06cd763fa2db71118f99240474c48e0d79a 100644 (file)
@@ -32,8 +32,6 @@ namespace component_based {
 Application::Application() {
 }
 
-Application::~Application() = default;
-
 void Application::OnLoopInit(int argc, char** argv) {
   LOGD("");
   elm_init(argc, argv);
index 4847b11704d9a90877e5fc87e01ba6717bde3ad6..247bd7c260c0db61b636fa2efc01b81e7d691ef8 100644 (file)
@@ -31,7 +31,7 @@ namespace component_based {
 class EXPORT_API Application : public ApplicationBase {
  public:
   Application();
-  virtual ~Application();
+  virtual ~Application() = default;
 
   std::map<std::string, std::unique_ptr<Component::FactoryBase>>
       OnCreateFactoryMap() override;
index 22850d1e67441869a11a0184c7791241c0e7bb41..0da939542bd45f0802d1c0d8f25a129335399060 100644 (file)
@@ -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_;
 }
index fb70d4da55b42e724cc829552ad05e930d249751..8a993f4146a3ea432ffa222264049fb571af381e 100644 (file)
@@ -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;
index 941d21ad3c81c7f3f67d80cb6ae79b1d91f014d0..2dcc41f6ebfd86dbd00079606c54bcc64ba4cea2 100644 (file)
@@ -25,10 +25,6 @@ Request::Request(std::string sender, bool sync, std::vector<uint8_t> 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_);
index cb3589c27a73125a152c88c84aab881a0270358a..ed3baf4001284f7bbe7df725536f440b43c2c14d 100644 (file)
@@ -28,8 +28,8 @@ namespace component_based {
 class Request : public tizen_base::Parcelable {
  public:
   Request(std::string sender, bool sync, std::vector<uint8_t> data);
-  Request();
-  virtual ~Request();
+  Request() = default;
+  virtual ~Request() = default;
 
   void WriteToParcel(tizen_base::Parcel* parcel) const override;
   void ReadFromParcel(tizen_base::Parcel* parcel) override;
index ca4ed4fd0531a18bafe7f11a84659ea63a8c3759..d90a5505b4a2d182970c67a8a60775268493dc32 100644 (file)
@@ -25,10 +25,6 @@ Response::Response(int32_t result, std::vector<uint8_t> 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());
index 9c8bdac2f7b78f8c81393d3ed0c9bf7bb8718099..490c570d4ae5a7853318c20c3f47bd3c2721dcd5 100644 (file)
@@ -28,8 +28,8 @@ namespace component_based {
 class Response : public tizen_base::Parcelable {
  public:
   Response(int32_t result, std::vector<uint8_t> data);
-  Response();
-  virtual ~Response();
+  Response() = default;
+  virtual ~Response() = default;
 
   void WriteToParcel(tizen_base::Parcel* parcel) const override;
   void ReadFromParcel(tizen_base::Parcel* parcel) override;
index fdd1025ea8a4224df53199847f35e3e74b7a03ff..46aa0202abf57098e8098426e3d484b4d2f990ad 100644 (file)
@@ -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_;
 }
index 44c11526a8fd2b9e8ed338eee1360e6fd4b34b1b..f3af1a4a9768a02ff4a808e1738e397d790739f1 100644 (file)
@@ -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;
index e8234f5ad3ba03354194963722e6426005a20863..f5dfaf22b861510323f607f9779c7fac7cea1bdb 100644 (file)
@@ -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_;
 }
index 39446be141566751c089e31ae8ef781a9556dfc7..6d2df467f572eeda8ab95e914656349b165378fb 100644 (file)
@@ -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> query_list_;
   };
 
-  Uri();
+  Uri() = default;
   explicit Uri(std::string encoded_uri);
   Uri(std::string scheme, std::string auth,
       std::string path, std::list<Query> query,
       std::string fragment);
-  virtual ~Uri();
+  virtual ~Uri() = default;
 
   const std::string& GetScheme() const;
   const std::string& GetAuthority() const;
index ea9bc82af522d7b7f96f9fdebeed6e8072b3da7c..5a7e259caf6fcde00d0de7dd66281a8a516f11a4 100644 (file)
@@ -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);
 }