Fix static analysis issues 06/313706/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Mon, 1 Jul 2024 06:40:10 +0000 (15:40 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Mon, 1 Jul 2024 06:40:10 +0000 (15:40 +0900)
Change-Id: I602cd4c52327a1863a30bdd01f0c78ac8c38f03f
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/server/appinfo_internal.cc
src/server/pkginfo_internal.cc

index d6f2359..c44508b 100644 (file)
@@ -288,13 +288,13 @@ constexpr const char join_privilege[] =
     " LEFT OUTER JOIN package_privilege_info"
     " ON ai.package=package_privilege_info.package ";
 
-int GetFilteredQuery(pkgmgrinfo_filter_x* filter, const char* locale,
+void GetFilteredQuery(pkgmgrinfo_filter_x* filter, const char* locale,
     uid_t uid, std::string& query, std::list<std::string>& bind_params) {
   int joined = 0;
   char* condition = nullptr;
 
   if (!filter)
-    return PMINFO_R_OK;
+    return;
 
   if (filter->cache_flag) {
     joined = E_PMINFO_APPINFO_JOIN_LOCALIZED_INFO |
@@ -354,8 +354,6 @@ int GetFilteredQuery(pkgmgrinfo_filter_x* filter, const char* locale,
 
   query = tmp_query + buf;
   g_list_free_full(tmp_params, free);
-
-  return PMINFO_R_OK;
 }
 
 bool __check_app_storage_status(pkgmgrinfo_filter_x* tmp_filter) {
@@ -538,11 +536,7 @@ int DoGetAppInfo(const tizen_base::Database& db, uid_t db_uid, uid_t uid,
   is_check_storage = __check_app_storage_status(filter);
 
   std::string constraint;
-  int ret = GetFilteredQuery(filter, locale, uid, constraint, bind_params);
-  if (ret != PMINFO_R_OK) {
-    LOGE("Failed to get WHERE clause");
-    return PMINFO_R_ERROR;
-  }
+  GetFilteredQuery(filter, locale, uid, constraint, bind_params);
 
   query += query_from_clause;
   query += query_uid_info_clause;
index b2000ca..a743341 100644 (file)
@@ -326,11 +326,11 @@ int GetPackageMetadata(const tizen_base::Database& db,
   return PMINFO_R_OK;
 }
 
-int _get_filtered_query(pkgmgrinfo_filter_x *filter,
+void _get_filtered_query(pkgmgrinfo_filter_x *filter,
     const std::string& locale, uid_t uid,
     std::string& query, std::vector<std::string>& bind_params) {
   if (!filter)
-    return PMINFO_R_OK;
+    return;
 
   int joined = 0;
   if (filter->cache_flag) {
@@ -387,8 +387,6 @@ int _get_filtered_query(pkgmgrinfo_filter_x *filter,
 
   query = buf2 + buf;
   g_list_free_full(tmp_params, free);
-
-  return PMINFO_R_OK;
 }
 
 bool CheckPackageStorageStatus(pkgmgrinfo_filter_x* tmp_filter) {
@@ -476,7 +474,6 @@ int DoGetPkgInfo(const tizen_base::Database& db, uid_t uid,
   static const char query_res_lib[] =
     ", (SELECT lib FROM package_res_info WHERE pi.package=package)";
   static const char query_from_clause[] = " FROM package_info as pi";
-  int ret = PMINFO_R_ERROR;
   char* tmp_record = nullptr;
   std::vector<std::string> bind_params;
   bool is_check_storage = true;
@@ -516,12 +513,7 @@ int DoGetPkgInfo(const tizen_base::Database& db, uid_t uid,
 
   query += query_from_clause;
   std::string constraints;
-  ret = _get_filtered_query(filter, locale, uid,
-      constraints, bind_params);
-  if (ret != PMINFO_R_OK) {
-    LOGE("Failed to get WHERE clause");
-    return PMINFO_R_EINVAL;
-  }
+  _get_filtered_query(filter, locale, uid, constraints, bind_params);
 
   if (!constraints.empty())
     query += constraints;