Remove TODOs
authorJunghyun Yeon <jungh.yeon@samsung.com>
Mon, 15 Mar 2021 10:31:59 +0000 (19:31 +0900)
committer연정현/Tizen Platform Lab(SR)/Staff Engineer/삼성전자 <jungh.yeon@samsung.com>
Mon, 15 Mar 2021 22:56:22 +0000 (07:56 +0900)
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/common/database/query_handler.cc
src/common/request_handler/set_cert_request_handler.cc
src/manager/pkginfo_manager.cc
src/pkgmgrinfo_appinfo.c
src/pkgmgrinfo_internal.h
src/pkgmgrinfo_pkginfo.c

index a89c92e..be553df 100644 (file)
@@ -91,7 +91,10 @@ int QueryHandler::Execute() {
 
     for (auto& conn : conn_list) {
       ret = execute_write_queries(conn.first, queries, query_.size());
-      // TODO: error check?
+      if (ret != PMINFO_R_OK) {
+        _LOGE("Failed to execute");
+        break;
+      }
     }
     free(queries);
     return ret;
index 5c0dee5..43b1355 100644 (file)
@@ -10,6 +10,8 @@
 #include "cert_set_db_handler.hh"
 #include "parcelable_factory.hh"
 
+#include "pkgmgrinfo_debug.h"
+
 namespace pcp = pkgmgr_common::parcel;
 namespace pcd = pkgmgr_common::database;
 
@@ -23,13 +25,17 @@ bool SetCertRequestHandler::HandleRequest(unsigned char* data, int size,
 
   if (abstract_parcel == nullptr ||
       abstract_parcel->GetType() != pcp::ParcelableType::CertInfo) {
-    // TODO: need to set result
+    _LOGE("Invalid parcel");
+    result_ = std::make_shared<pcp::ResultParcelable>(
+        PMINFO_R_ERROR, std::vector<std::vector<std::string>>{});
     return false;
   }
 
   auto* parcel = dynamic_cast<pcp::CertInfoParcelable*>(abstract_parcel.get());
   if (parcel == nullptr) {
-    // TODO: need to set result
+    _LOGE("Parcel is empty");
+    result_ = std::make_shared<pcp::ResultParcelable>(
+        PMINFO_R_ERROR, std::vector<std::vector<std::string>>{});
     return false;
   }
 
@@ -40,7 +46,6 @@ bool SetCertRequestHandler::HandleRequest(unsigned char* data, int size,
   int ret = db.Execute();
   result_ = std::make_shared<pcp::ResultParcelable>(
       ret, std::vector<std::vector<std::string>>{});
-  // TODO: need to set result
 
   return true;
 }
index 5c9ac69..7cfde8c 100644 (file)
@@ -89,7 +89,10 @@ extern "C" EXPORT_API int _pkginfo_get_packages(uid_t uid,
           ptr));
 
   auto result_list = return_parcel->ExtractPkgInfo();
-  // TODO: check noentry error has returned if size of result_list is 0
+  if (result_list.size() == 0) {
+    LOG(DEBUG) << "No packages meets given condition for user " << uid;
+    return PMINFO_R_ENOENT;
+  }
   for (auto &pkginfo : result_list)
     g_hash_table_insert(packages, (gpointer)pkginfo->package,
                         (gpointer)pkginfo);
index 9ab645c..0ca5fd9 100644 (file)
@@ -90,7 +90,6 @@ static int _pkgmgrinfo_get_appinfo(const char *appid, uid_t uid,
        if (list == NULL)
                return PMINFO_R_ERROR;
 
-       // TODO: need to use pkginfo-client APIs
        ret = _appinfo_get_applications(uid, uid, filter,
                        PMINFO_APPINFO_GET_ALL, list);
        if (ret != PMINFO_R_OK) {
@@ -2340,7 +2339,6 @@ API int pkgmgrinfo_appinfo_usr_filter_count(pkgmgrinfo_appinfo_filter_h handle,
                }
        }
 
-       // TODO: use pkginfo-client APIs
        *count = g_hash_table_size(list);
        g_hash_table_destroy(list);
 
index 448c7b2..0fd5c5e 100644 (file)
@@ -31,7 +31,6 @@
 extern "C" {
 #endif
 
-// TODO: should we get sqlite handle as parameter??
 int pkginfo_internal_filter_get_list(sqlite3 *db, pkgmgrinfo_pkginfo_filter_h filter, uid_t uid, const char *locale, GHashTable *list);
 int appinfo_internal_filter_get_list(sqlite3 *db, pkgmgrinfo_appinfo_filter_h filter, uid_t uid, const char *locale, GHashTable *list);
 int certinfo_internal_get(sqlite3 *db, const char *pkgid, uid_t uid, pkgmgrinfo_certinfo_h certinfo);
index 1bdb55f..ee3b0c6 100644 (file)
@@ -1482,7 +1482,6 @@ static void __free_depends_on(gpointer data)
        pkgmgrinfo_basic_free_dependency(dep);
 }
 
-// TODO: need to change this
 API int pkgmgrinfo_pkginfo_foreach_depends_on(pkgmgrinfo_pkginfo_h handle,
                pkgmgrinfo_pkg_dependency_list_cb dependency_cb,
                void *user_data)