Fix static analysis issue
[platform/core/appfw/pkgmgr-info.git] / src / server / appinfo_internal.cc
index 01d1879..d6f2359 100644 (file)
@@ -85,11 +85,11 @@ void ParseAppControl(GList** appcontrol,
 
 int GetSplashScreens(const tizen_base::Database& db,
     const char* appid, GList** splashscreens) {
-  auto q = tizen_base::Database::Sql(
+  auto q = std::move(tizen_base::Database::Sql(
       "SELECT src, type, orientation, indicatordisplay, "
       "operation, color_depth "
       "FROM package_app_splash_screen WHERE app_id=?")
-      .Bind(appid);
+      .Bind(appid));
 
   auto r = db.Exec(q);
   if (!r) {
@@ -120,10 +120,10 @@ int GetSplashScreens(const tizen_base::Database& db,
 
 int GetMetadata(const tizen_base::Database& db,
     const char* appid, GList** metadata) {
-  auto q = tizen_base::Database::Sql(
+  auto q = std::move(tizen_base::Database::Sql(
       "SELECT md_key, md_value "
       "FROM package_app_app_metadata WHERE app_id=?")
-      .Bind(appid);
+      .Bind(appid));
 
   auto r = db.Exec(q);
   if (!r) {
@@ -150,10 +150,10 @@ int GetMetadata(const tizen_base::Database& db,
 
 int GetAppControl(const tizen_base::Database& db,
     const char* appid, GList** appcontrol) {
-  auto q = tizen_base::Database::Sql(
+  auto q = std::move(tizen_base::Database::Sql(
       "SELECT app_control, visibility, app_control_id "
       "FROM package_app_app_control WHERE app_id=?")
-      .Bind(appid);
+      .Bind(appid));
 
   auto r = db.Exec(q);
   if (!r) {
@@ -171,10 +171,10 @@ int GetAppControl(const tizen_base::Database& db,
 
 int GetCategory(const tizen_base::Database& db,
     const char* appid, GList** category) {
-  auto q = tizen_base::Database::Sql(
+  auto q = std::move(tizen_base::Database::Sql(
       "SELECT category "
       "FROM package_app_app_category WHERE app_id=?")
-      .Bind(appid);
+      .Bind(appid));
   auto r = db.Exec(q);
   if (!r) {
     _LOGE("db.Exec() failed: %s", static_cast<const char*>(r));
@@ -192,10 +192,10 @@ int GetCategory(const tizen_base::Database& db,
 
 int GetResControl(const tizen_base::Database& db, const char* appid,
     GList** res_control) {
-  auto q = tizen_base::Database::Sql(
+  auto q = std::move(tizen_base::Database::Sql(
       "SELECT res_type, min_res_version, max_res_version, auto_close "
       "FROM package_app_res_control WHERE app_id=?")
-      .Bind(appid);
+      .Bind(appid));
 
   auto r = db.Exec(q);
   if (!r) {
@@ -398,7 +398,7 @@ PackageDisableFilterStatus GetPackageDisableFilterStatus(
   int property = -1;
 
   property = _pminfo_appinfo_convert_to_prop_bool(
-        PMINFO_APPINFO_PROP_APP_DISABLE);
+        PMINFO_APPINFO_PROP_PKG_DISABLE);
   for (tmp_list = filter->list; tmp_list != nullptr;
       tmp_list = g_slist_next(tmp_list)) {
     tmp_node = reinterpret_cast<pkgmgrinfo_node_x*>(tmp_list->data);
@@ -638,7 +638,8 @@ int DoGetAppInfo(const tizen_base::Database& db, uid_t db_uid, uid_t uid,
     } else {
       tmp_record = GetCString(idx++, rec);
       if (tmp_record != nullptr) {
-        if (strcasecmp(info->is_disabled, "false") == 0 &&
+        if (info->is_disabled &&
+            strcasecmp(info->is_disabled, "false") == 0 &&
             strcasecmp(tmp_record, "false") == 0) {
           free(info->is_disabled);
           info->is_disabled = tmp_record;
@@ -648,7 +649,8 @@ int DoGetAppInfo(const tizen_base::Database& db, uid_t db_uid, uid_t uid,
       }
       tmp_record = GetCString(idx++, rec);
       if (tmp_record != nullptr) {
-        if (strcasecmp(info->splash_screen_display, "false") == 0 &&
+        if (info->splash_screen_display &&
+            strcasecmp(info->splash_screen_display, "false") == 0 &&
             strcasecmp(tmp_record, "false") == 0) {
           free(info->splash_screen_display);
           info->splash_screen_display = tmp_record;