Fix coding style 36/279536/2
authorChanggyu Choi <changyu.choi@samsung.com>
Thu, 11 Aug 2022 06:15:41 +0000 (15:15 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Thu, 11 Aug 2022 06:23:23 +0000 (15:23 +0900)
Changes:
 - Adds missing headers.
 - Fix wrong indents.
 - Adds explicit keyword.

Change-Id: I432ace3e6af683d5546fe41ce88e37e422bbc9a5
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
25 files changed:
aul/api/aul_app_context.cc
aul/api/aul_app_event.cc
aul/api/aul_app_lifecycle.cc
aul/app_manager/app_context.hh
aul/app_manager/app_event.hh
aul/common/file_descriptor.hh
aul/component/component_port.hh
aul/socket/client.hh
aul/socket/packet.cc
aul/socket/socket.hh
parser/boot-sequencer/app_info.hh
parser/boot-sequencer/appsvc_db.hh
parser/boot-sequencer/database.hh
parser/metadata/alias-appid/appsvc_db.hh
parser/metadata/alias-appid/pkgmgr_interface.cc
parser/metadata/allowed-appid/appsvc_db.hh
parser/metadata/allowed-appid/pkgmgr_interface.cc
parser/metadata/common/database.hh
parser/metadata/common/metadata_plugin.hh
server/boot_sequence.hh
server/database.hh
src/app_signal.cc
src/aul_svc.cc
src/launch.cc
test/app_control_tests/test_app_control.cc

index 6238865..d0134af 100644 (file)
@@ -19,6 +19,8 @@
 #include <tizen.h>
 #include <unistd.h>
 
+#include <memory>
+
 #include "aul/api/aul_app_context.h"
 #include "aul/app_manager/app_manager.hh"
 #include "aul/common/api.hh"
index b93af89..9ff717f 100644 (file)
@@ -18,6 +18,9 @@
 
 #include <glib.h>
 
+#include <string>
+#include <utility>
+
 #include "aul/app_manager/app_event.hh"
 #include "aul/common/api.hh"
 #include "aul/common/exception.hh"
index dadb376..6566e6c 100644 (file)
@@ -16,6 +16,9 @@
 
 #include <bundle_cpp.h>
 
+#include <memory>
+#include <string>
+
 #include "aul/api/aul_app_lifecycle.h"
 #include "aul/common/api.hh"
 #include "aul/common/exception.hh"
@@ -106,7 +109,7 @@ extern "C" API int aul_app_lifecycle_register_state_changed_cb(
 }
 
 extern "C" API int aul_app_lifecycle_deregister_state_changed_cb(void) {
- return listener.Deregister();
 return listener.Deregister();
 }
 
 extern "C" API int aul_app_lifecycle_update_state(
index d997b37..4ef30f2 100644 (file)
@@ -46,7 +46,7 @@ class AppContext {
     bool is_sub_app_;
   };
 
-  AppContext(tizen_base::Bundle b);
+  explicit AppContext(tizen_base::Bundle b);
   virtual ~AppContext();
 
   const std::string& GetAppId() const;
index 4cd6b10..84e87a2 100644 (file)
@@ -34,7 +34,7 @@ class AppEvent {
   };
 
   AppEvent(std::string app_id, IEvent* ev);
-  AppEvent(IEvent* ev);
+  explicit AppEvent(IEvent* ev);
   virtual ~AppEvent();
 
  private:
index 80f9fd5..693aad2 100644 (file)
@@ -24,7 +24,7 @@ namespace aul {
 
 class FileDescriptor {
  public:
-  FileDescriptor(int fd = -1) : fd_(fd) {}
+  explicit FileDescriptor(int fd = -1) : fd_(fd) {}
 
   virtual ~FileDescriptor() {
     if (fd_ > -1)
index 44903f2..7de6d0b 100644 (file)
@@ -23,7 +23,7 @@ namespace aul {
 
 class ComponentPort {
  public:
-  ComponentPort(std::string name);
+  explicit ComponentPort(std::string name);
   virtual ~ComponentPort();
 
   bool Exist();
index ca6a5cf..ba50a91 100644 (file)
@@ -24,7 +24,7 @@ namespace aul {
 
 class Client : public Socket {
  public:
-  Client(std::string path, int timeout_msec = 5000);
+  explicit Client(std::string path, int timeout_msec = 5000);
   int Send(const Packet& packet);
   int Recv(Packet** packet);
 };
index 4ff8507..d291274 100644 (file)
@@ -88,7 +88,7 @@ void Packet::ReadFromParcel(tizen_base::Parcel* parcel) {
   parcel->ReadInt32(&size);
   parcel->ReadInt32(&opt_);
   if (size > 0) {
-    auto* data = new (std::nothrow) unsigned char [size];
+    auto* data = new (std::nothrow) unsigned char[size];
     if (data == nullptr)
       return;
 
index 928ad9f..95e08c8 100644 (file)
@@ -31,8 +31,8 @@ static const int MAX_AUL_BUFF_SIZE = 131071;
 
 class Socket {
  public:
-  Socket(std::string path);
-  Socket(int fd);
+  explicit Socket(std::string path);
+  explicit Socket(int fd);
   virtual ~Socket();
 
   int Send(const void* buf, unsigned int len);
index d9de0f3..dae8c1a 100644 (file)
@@ -23,7 +23,7 @@ namespace boot_sequencer {
 
 class AppInfo {
  public:
-  AppInfo(std::string appid);
+  explicit AppInfo(std::string appid);
 
   const std::string& GetAppId() const;
   const std::string& GetAfter() const;
index 4aedad6..f63d98d 100644 (file)
@@ -30,7 +30,7 @@ namespace boot_sequencer {
 
 class AppSvcDB : public Database {
  public:
-  AppSvcDB(uid_t uid);
+  explicit AppSvcDB(uid_t uid);
   virtual ~AppSvcDB();
 
   std::vector<std::shared_ptr<AppInfo>> Select(const std::string& package);
index 8e0b9ed..14a4f32 100644 (file)
@@ -50,7 +50,7 @@ class Database {
     bool done_ = false;
   };
 
-  Database(std::string path);
+  explicit Database(std::string path);
   virtual ~Database();
 
   void Open();
index 04190de..abc6933 100644 (file)
@@ -30,7 +30,7 @@ namespace plugin {
 
 class AppSvcDB : public Database {
  public:
-  AppSvcDB(uid_t uid);
+  explicit AppSvcDB(uid_t uid);
   virtual ~AppSvcDB();
 
   std::vector<std::shared_ptr<AliasInfo>> Select(const std::string& appid);
index edb4faa..bb414cc 100644 (file)
@@ -25,8 +25,7 @@
 using namespace plugin;
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
       EventType::Install, list);
@@ -35,8 +34,7 @@ extern "C" API int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char* pkgid,
 }
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
       EventType::Uninstall, list);
@@ -45,8 +43,7 @@ extern "C" API int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(const char* pkgid,
 }
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
       EventType::Upgrade, list);
@@ -55,8 +52,7 @@ extern "C" API int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char* pkgid,
 }
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERINSTALL(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
       EventType::Uninstall, list);
@@ -65,8 +61,7 @@ extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERINSTALL(const char* pkgid,
 }
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERUNINSTALL(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
       EventType::Uninstall, list);
@@ -75,8 +70,7 @@ extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERUNINSTALL(const char* pkgid,
 }
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERUPGRADE(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
       EventType::Upgrade, list);
@@ -85,24 +79,21 @@ extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERUPGRADE(const char* pkgid,
 }
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_CLEAN(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   PluginManager::GetInst().Clean();
   return 0;
 }
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_UNDO(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   PluginManager::GetInst().Undo();
   return 0;
 }
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_REMOVED(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALIAS_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   return 0;
 }
index a66f6be..3cc0cd0 100644 (file)
@@ -30,7 +30,7 @@ namespace plugin {
 
 class AppSvcDB : public Database {
  public:
-  AppSvcDB(uid_t uid);
+  explicit AppSvcDB(uid_t uid);
   virtual ~AppSvcDB();
 
   std::vector<std::shared_ptr<AllowedInfo>> Select(const std::string& appid);
index 3c16f90..2c6bfb9 100644 (file)
@@ -25,8 +25,7 @@
 using namespace plugin;
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
       EventType::Install, list);
@@ -35,8 +34,7 @@ extern "C" API int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char* pkgid,
 }
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
       EventType::Uninstall, list);
@@ -45,8 +43,7 @@ extern "C" API int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(const char* pkgid,
 }
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
       EventType::Upgrade, list);
@@ -55,8 +52,7 @@ extern "C" API int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char* pkgid,
 }
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERINSTALL(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
       EventType::Uninstall, list);
@@ -65,8 +61,7 @@ extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERINSTALL(const char* pkgid,
 }
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERUNINSTALL(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
       EventType::Uninstall, list);
@@ -75,8 +70,7 @@ extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERUNINSTALL(const char* pkgid,
 }
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERUPGRADE(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   PluginManager::GetInst().AddAppEventArgs(pkgid, appid,
       EventType::Upgrade, list);
@@ -85,24 +79,21 @@ extern "C" API int PKGMGR_MDPARSER_PLUGIN_RECOVERUPGRADE(const char* pkgid,
 }
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_CLEAN(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   PluginManager::GetInst().Clean();
   return 0;
 }
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_UNDO(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   PluginManager::GetInst().Undo();
   return 0;
 }
 
 extern "C" API int PKGMGR_MDPARSER_PLUGIN_REMOVED(const char* pkgid,
-    const char* appid, GList* list)
-{
+    const char* appid, GList* list) {
   _W("[__ALLOWED_APPID__] pkgid(%s), appid(%s)", pkgid, appid);
   return 0;
 }
index 37302a0..89326af 100644 (file)
@@ -54,7 +54,7 @@ namespace plugin {
 
 class Database {
  public:
-  Database(std::string path);
+  explicit Database(std::string path);
   virtual ~Database();
 
   void Open();
index 2416f69..525992d 100644 (file)
@@ -31,7 +31,7 @@ namespace plugin {
 
 class MetadataPlugin {
  public:
-  MetadataPlugin(std::unique_ptr<Database> db) : db_(std::move(db)) { }
+  explicit MetadataPlugin(std::unique_ptr<Database> db) : db_(std::move(db)) { }
   virtual ~MetadataPlugin() = default;
 
   void AddAppEventArgs(const std::string& pkgid, const std::string& appid,
index 550f98d..6f8c37c 100644 (file)
@@ -23,7 +23,7 @@ namespace aul {
 
 class BootSequence {
  public:
-  BootSequence(std::string appid);
+  explicit BootSequence(std::string appid);
 
   const std::string& GetAppId() const;
   const std::string& GetAfter() const;
index 06c4e99..9ed07fd 100644 (file)
@@ -68,7 +68,7 @@ namespace aul {
 
 class Database {
  public:
-  Database(std::string path, bool enable_foreign_keys = true);
+  explicit Database(std::string path, bool enable_foreign_keys = true);
   virtual ~Database();
 
   void Open(int flags = SQLITE_OPEN_READWRITE);
index cead0f4..fff4780 100644 (file)
@@ -68,48 +68,48 @@ class Event {
         signal_name_(std::move(signal_name)),
         cb_(cb),
         user_data_(user_data) {
-   }
+  }
 
-   virtual ~Event() {
-     Unsubscribe();
-   }
+  virtual ~Event() {
+    Unsubscribe();
+  }
 
-   const std::string& GetObjectPath() const { return object_path_; }
+  const std::string& GetObjectPath() const { return object_path_; }
 
-   const std::string& GetInterfaceName() const { return interface_name_; }
+  const std::string& GetInterfaceName() const { return interface_name_; }
 
-   const std::string& GetSignalName() const { return signal_name_; }
+  const std::string& GetSignalName() const { return signal_name_; }
 
-   virtual void Invoke(GVariant* parameters) {}
+  virtual void Invoke(GVariant* parameters) {}
 
-   T GetCallback() const { return cb_; }
+  T GetCallback() const { return cb_; }
 
-   void* GetUserData() const { return user_data_; }
+  void* GetUserData() const { return user_data_; }
 
-   bool Subscribe() {
-     if (source_ != 0)
-       return true;
+  bool Subscribe() {
+    if (source_ != 0)
+      return true;
 
-     GError* err = nullptr;
-     conn_ = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &err);
-     if (conn_ == nullptr) {
-       _E("g_bus_get_sync() is failed. error(%s)", err ? err->message : "");
-       g_clear_error(&err);
-       return false;
-     }
+    GError* err = nullptr;
+    conn_ = g_bus_get_sync(G_BUS_TYPE_SYSTEM, nullptr, &err);
+    if (conn_ == nullptr) {
+      _E("g_bus_get_sync() is failed. error(%s)", err ? err->message : "");
+      g_clear_error(&err);
+      return false;
+    }
 
-     source_ = g_dbus_connection_signal_subscribe(conn_, nullptr,
-         interface_name_.c_str(), signal_name_.c_str(), object_path_.c_str(),
+    source_ = g_dbus_connection_signal_subscribe(conn_, nullptr,
+        interface_name_.c_str(), signal_name_.c_str(), object_path_.c_str(),
          nullptr, G_DBUS_SIGNAL_FLAGS_NONE, DBusSignalCb, this, nullptr);
-     if (source_ == 0) {
-       _E("g_dbus_connection_signal_subscribe() is failed");
-       g_object_unref(conn_);
-       conn_ = nullptr;
-       return false;
-     }
+    if (source_ == 0) {
+      _E("g_dbus_connection_signal_subscribe() is failed");
+      g_object_unref(conn_);
+      conn_ = nullptr;
+      return false;
+    }
 
-     return true;
-   }
+    return true;
+  }
 
  private:
   void Unsubscribe() {
@@ -448,7 +448,8 @@ extern "C" API int aul_listen_app_launch_signal_v2(
 
 extern "C" API int aul_listen_booting_done_signal(
     aul_booting_done_event_cb callback, void* user_data) {
-  _W("DEPRECATION WARNING: %s() is deprecated and will be remove from next release.", __FUNCTION__);
+  _W("DEPRECATION WARNING: %s() is deprecated "
+      "and will be remove from next release.", __FUNCTION__);
   if (!context.BootingDoneEventSubscribe(callback, user_data))
     return AUL_R_ERROR;
 
@@ -457,7 +458,8 @@ extern "C" API int aul_listen_booting_done_signal(
 
 extern "C" API int aul_listen_cooldown_signal(aul_cooldown_event_cb callback,
     void *user_data) {
-  _W("DEPRECATION WARNING: %s() is deprecated and will be remove from next release.", __FUNCTION__);
+  _W("DEPRECATION WARNING: %s() is deprecated "
+      "and will be remove from next release.", __FUNCTION__);
   if (!context.CooldownEventSubscribe(callback, user_data))
     return AUL_R_ERROR;
 
index 5a35a0e..cb565db 100644 (file)
@@ -84,7 +84,7 @@ class CbInfo {
 
 class AliasInfo {
  public:
-  AliasInfo(std::string alias_appid)
+  explicit AliasInfo(std::string alias_appid)
       : alias_appid_(std::move(alias_appid)) {
   }
 
index 50e9b2e..3d05137 100644 (file)
@@ -258,7 +258,7 @@ extern "C" API int aul_request_message_port_socket_pair(int* fd) {
   int ret = AppRequest(APP_GET_MP_SOCKET_PAIR)
       .SendCmdOnly(AUL_SOCK_ASYNC);
   if (ret > 0) {
-    int fds[2] = {0,};
+    int fds[2] = {0, };
     ret = aul_sock_recv_reply_sock_fd(ret, &fds, 2);
     if (ret == 0) {
       fd[0] = fds[0];
index c2c3054..eb3bef0 100644 (file)
@@ -201,18 +201,18 @@ TEST_F(AppControlTest, app_control_resolution_call_tel) {
 }
 
 TEST_F(AppControlTest, app_control_resolution_compose) {
-  bool ret= Compare(APP_CONTROL_OPERATION_COMPOSE, "", "");
+  bool ret = Compare(APP_CONTROL_OPERATION_COMPOSE, "", "");
   EXPECT_EQ(ret, true);
 }
 
 TEST_F(AppControlTest, app_control_resolution_compose_sms) {
-  bool ret= Compare(APP_CONTROL_OPERATION_COMPOSE,
+  bool ret = Compare(APP_CONTROL_OPERATION_COMPOSE,
       "sms:+19725551212?body=hello%20there", "");
   EXPECT_EQ(ret, true);
 }
 
 TEST_F(AppControlTest, app_control_resolution_compose_mmsto) {
-  bool ret= Compare(APP_CONTROL_OPERATION_COMPOSE,
+  bool ret = Compare(APP_CONTROL_OPERATION_COMPOSE,
       "mmsto:addr1%2C%20addr2", "");
   EXPECT_EQ(ret, true);
 }
@@ -403,7 +403,7 @@ TEST_F(AppControlTest, app_control_resolution_setting_location) {
 }
 
 TEST_F(AppControlTest, app_control_resolution_setting_messages) {
-  bool ret= Compare(APP_CONTROL_OPERATION_SETTING_MESSAGES,
+  bool ret = Compare(APP_CONTROL_OPERATION_SETTING_MESSAGES,
       "", "");
   EXPECT_EQ(ret, true);
 }
@@ -433,19 +433,19 @@ TEST_F(AppControlTest, app_control_resolution_setting_vpn) {
 }
 
 TEST_F(AppControlTest, app_control_resolution_share_text) {
-  bool ret= Compare(APP_CONTROL_OPERATION_SHARE_TEXT,
+  bool ret = Compare(APP_CONTROL_OPERATION_SHARE_TEXT,
       "", "");
   EXPECT_EQ(ret, true);
 }
 
 TEST_F(AppControlTest, app_control_resolution_share_text_sms) {
-  bool ret= Compare(APP_CONTROL_OPERATION_SHARE_TEXT,
+  bool ret = Compare(APP_CONTROL_OPERATION_SHARE_TEXT,
       "sms:+19725551212?body=hello%20there", "");
   EXPECT_EQ(ret, true);
 }
 
 TEST_F(AppControlTest, app_control_resolution_share_text_mmsto) {
-  bool ret= Compare(APP_CONTROL_OPERATION_SHARE_TEXT,
+  bool ret = Compare(APP_CONTROL_OPERATION_SHARE_TEXT,
       "mmsto:addr1%2C%20addr2", "");
   EXPECT_EQ(ret, true);
 }