- Supress build warnings.
- Fix coding rule.
- Adjust log level.
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
GList *tmp;
application_x *application;
- if ((lib_handle = dlopen(LIBAPPSVC_PATH, RTLD_LAZY)) == NULL) {
+ lib_handle = dlopen(LIBAPPSVC_PATH, RTLD_LAZY);
+ if (lib_handle == NULL) {
_LOGE("dlopen is failed LIBAPPSVC_PATH[%s]\n", LIBAPPSVC_PATH);
goto END;
}
- if ((appsvc_operation =
- dlsym(lib_handle, "appsvc_unset_defapp")) == NULL || dlerror() != NULL) {
+ appsvc_operation = dlsym(lib_handle, "appsvc_unset_defapp");
+ if (appsvc_operation == NULL || dlerror() != NULL) {
_LOGE("can not find symbol \n");
goto END;
}
return pkgmgr_parser_update_tep_info_in_db(pkgid, tep_path);
}
-API int pkgmgr_parser_process_manifest_x_for_installation(manifest_x* mfx)
+API int pkgmgr_parser_process_manifest_x_for_installation(manifest_x *mfx)
{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
int ret = -1;
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_usr_manifest_x_for_installation(manifest_x* mfx, uid_t uid)
+API int pkgmgr_parser_process_usr_manifest_x_for_installation(manifest_x *mfx, uid_t uid)
{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
int ret = -1;
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_manifest_x_for_upgrade(manifest_x* mfx)
+API int pkgmgr_parser_process_manifest_x_for_upgrade(manifest_x *mfx)
{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
int ret = -1;
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_usr_manifest_x_for_upgrade(manifest_x* mfx, uid_t uid)
+API int pkgmgr_parser_process_usr_manifest_x_for_upgrade(manifest_x *mfx, uid_t uid)
{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
int ret = -1;
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_manifest_x_for_uninstallation(manifest_x* mfx)
+API int pkgmgr_parser_process_manifest_x_for_uninstallation(manifest_x *mfx)
{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
int ret = -1;
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_usr_manifest_x_for_uninstallation(manifest_x* mfx, uid_t uid)
+API int pkgmgr_parser_process_usr_manifest_x_for_uninstallation(manifest_x *mfx, uid_t uid)
{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
int ret = -1;
return _parser_clear_cache_memory_db(uid);
}
-API int pkgmgr_parser_clear_cache_memory_db()
+API int pkgmgr_parser_clear_cache_memory_db(void)
{
return pkgmgr_parser_clear_cache_usr_memory_db(__getuid());
}
std::shared_ptr<pkgmgr_common::parcel::AbstractParcelable>
PkgInfoClient::GetResultParcel() {
- if (is_offline_) return result_parcel_;
+ if (is_offline_)
+ return result_parcel_;
if (socket_ == nullptr) {
LOGE("Socket is not ready");
handler->HandleRequest(&raw[0], raw.size(), locale.get());
auto result = handler->ExtractResult();
- if (result.size() == 0) return true;
+ if (result.size() == 0)
+ return true;
result_parcel_.reset(pkgmgr_common::parcel::ParcelableFactory::GetInst()
- .CreateParcel(&result[0], result.size())
- .release());
+ .CreateParcel(&result[0], result.size())
+ .release());
return true;
}
class PkgInfoClient {
public:
- PkgInfoClient(std::shared_ptr<pkgmgr_common::parcel::AbstractParcelable> parcel,
+ PkgInfoClient(
+ std::shared_ptr<pkgmgr_common::parcel::AbstractParcelable> parcel,
uid_t uid, pkgmgr_common::ReqType req_type);
~PkgInfoClient();
bool SendRequest();
#include "abstract_db_handler.hh"
#include <gio/gio.h>
+#include <stdlib.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <sys/sysmacros.h>
-#include <stdlib.h>
+#include <sys/types.h>
#include <tzplatform_config.h>
#include <string>
int AppInfoDBHandler::Execute() {
SetOpType(OPERATION_TYPE_READ);
SetDBType(DB_TYPE_FILE_PKGDB);
- if (!Connect()) return PMINFO_R_ERROR;
+ if (!Connect())
+ return PMINFO_R_ERROR;
GHashTable* list = g_hash_table_new_full(g_str_hash, g_str_equal,
NULL, __free_applications);
int ret = PMINFO_R_OK;
for (auto conn : conn_list) {
ret = appinfo_internal_filter_get_list(conn.first, filter_, conn.second,
- GetLocale().c_str(), list);
+ GetLocale().c_str(), list);
if (ret == PMINFO_R_ERROR) {
- _LOGE("Failed to appinfo_internal_filter_get_list (%d)", ret);
+ _LOGD("Failed to appinfo_internal_filter_get_list (%d)", ret);
break;
}
}
CertGetDBHandler::~CertGetDBHandler() {}
-pkgmgr_certinfo_x* CertGetDBHandler::GetCertHandle() { return handle_; }
+pkgmgr_certinfo_x* CertGetDBHandler::GetCertHandle() {
+ return handle_;
+}
void CertGetDBHandler::SetPkgID(std::string pkgid) {
pkgid_ = std::move(pkgid);
if (!Connect())
return PMINFO_R_ERROR;
- int ret = 0;
-
DBHandleProvider::GetInst(uid_).SetMemoryMode(GetPID(), true);
std::vector<std::pair<sqlite3*, uid_t>> conn_list = GetConnection();
sqlite3* conn = conn_list.front().first;
+ int ret = 0;
if (write_type_ == Insert)
ret = pkgmgr_parser_insert_pkg_info(conn, package_, uid_);
else if (write_type_ == Update)
pkgid_(""), auto_release_(true) {}
DepInfoParcelable::DepInfoParcelable(int ret,
- std::vector<dependency_x *>&& dependency_list, bool auto_release)
+ std::vector<dependency_x*>&& dependency_list, bool auto_release)
: AbstractParcelable(0, ParcelableType::DepInfo, ret),
pkgid_(""),
dependency_list_(std::move(dependency_list)),
if (!auto_release_)
return;
- for (auto dep : dependency_list_) {
+ for (auto dep : dependency_list_)
pkgmgrinfo_basic_free_dependency(dep);
- }
}
-const std::vector<dependency_x *>& DepInfoParcelable::GetDependencyInfo() {
+const std::vector<dependency_x*>& DepInfoParcelable::GetDependencyInfo() {
return dependency_list_;
}
-std::vector<dependency_x *> DepInfoParcelable::ExtractDependencyInfo() {
+std::vector<dependency_x*> DepInfoParcelable::ExtractDependencyInfo() {
return std::move(dependency_list_);
}
parcel->WriteString(pkgid_);
WriteInt(parcel, dependency_list_.size());
- for (auto dependency : dependency_list_) {
+ for (auto dependency : dependency_list_)
WriteDependency(parcel, dependency);
- }
}
void DepInfoParcelable::ReadFromParcel(tizen_base::Parcel* parcel) {
int len = 0;
- char *pkgid;
AbstractParcelable::ReadFromParcel(parcel);
pkgid_ = parcel->ReadString();
ReadInt(parcel, &len);
- for (int i = 0; i < len ; ++i) {
+ for (int i = 0; i < len ; ++i)
dependency_list_.emplace_back(ReadDependency(parcel));
- }
}
void DepInfoParcelable::WriteDependency(tizen_base::Parcel* parcel,
dependency_x *DepInfoParcelable::ReadDependency(tizen_base::Parcel* parcel) {
dependency_x* dep =
- reinterpret_cast<dependency_x*>(calloc(1, sizeof(dependency_x)));
+ reinterpret_cast<dependency_x*>(calloc(1, sizeof(dependency_x)));
ReadString(parcel, &dep->pkgid);
ReadString(parcel, &dep->depends_on);
ReadString(parcel, &dep->type);
-// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+// Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
// Use of this source code is governed by a apache 2.0 license that can be
// found in the LICENSE file.
}
if (ptr->GetRequestResult() != PMINFO_R_OK) {
- LOG(ERROR) << "Request fail";
+ if (ptr->GetRequestResult() == PMINFO_R_ERROR)
+ LOG(ERROR) << "Request fail";
return ptr->GetRequestResult();
}
std::shared_ptr<pcp::ResultParcelable> return_parcel(
std::static_pointer_cast<pcp::ResultParcelable>(ptr));
- // result_list is vector of string vector
auto result_list = return_parcel->GetResult();
if (result_list.size() == 0)
return PMINFO_R_ENOENT;
*
* Copyright (c) 2000 - 2019 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Junghyun Yeon <jungh.yeon@samsung.com>, Sangyoon Jang <jeremy.jang@samsung.com>
+ * Contact: Junghyun Yeon <jungh.yeon@samsung.com>,
+ * Sangyoon Jang <jeremy.jang@samsung.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
return PMINFO_R_EINVAL;
}
- ret = _plugininfo_get_appids(pkgid, plugin_type, plugin_name, &appid_list);
+ ret = _plugininfo_get_appids(pkgid, plugin_type, plugin_name,
+ &appid_list);
if (ret != PMINFO_R_OK) {
_LOGE("Fail to get plugininfo");
return ret;
}
- for (tmp_list = appid_list; tmp_list != NULL; tmp_list = tmp_list->next) {
+ for (tmp_list = appid_list; tmp_list != NULL;
+ tmp_list = tmp_list->next) {
appid = (char *)tmp_list->data;
if (!appid)
continue;
ret = plugin_list_cb(pkgid, appid, plugin_type,
- plugin_name, user_data);
+ plugin_name, user_data);
if (ret != 0)
break;
}
return ret;
-}
\ No newline at end of file
+}
const char *type;
};
-struct type_map type_map[] = {
+const struct type_map type_map[] = {
{ "res/wgt/config.xml", "wgt" },
{ "config.xml", "wgt" },
{ "tizen-manifest.xml", "tpk" },
return plugin_set;
}
- if ((library_handle = dlopen(library_path, RTLD_LAZY)) == NULL) {
+ library_handle = dlopen(library_path, RTLD_LAZY);
+ if (library_handle == NULL) {
_LOGE("dlopen is failed library_path[%s]", library_path);
return NULL;
}
- if ((on_load = dlsym(library_handle, "pkg_plugin_on_load")) == NULL ||
- dlerror() != NULL) {
+ on_load = dlsym(library_handle, "pkg_plugin_on_load");
+ if (on_load == NULL || dlerror() != NULL) {
_LOGE("cannot find symbol");
dlclose(library_handle);
return NULL;
}
static void __finish(void) {
- if (sig_source > 0) g_source_remove(sig_source);
+ if (sig_source > 0)
+ g_source_remove(sig_source);
- if (channel) g_io_channel_unref(channel);
+ if (channel)
+ g_io_channel_unref(channel);
- if (runner) delete runner;
+ if (runner)
+ delete runner;
}
static void __pkgmgr_init() { runner = new pkgmgr_server::Runner(5); }
int main() {
main_loop = g_main_loop_new(NULL, FALSE);
- if (!main_loop) return -1;
+ if (!main_loop)
+ return -1;
#if (GLIB_MAJOR_VERSION <= 2 && GLIB_MINOR_VERSION < 36)
g_type_init();
sd_notify(0, "READY=1");
__pkgmgr_init();
- if (__init_signal_handler() < 0) _LOGE("Failed to init signal handler");
+ if (__init_signal_handler() < 0)
+ _LOGE("Failed to init signal handler");
g_main_loop_run(main_loop);
: fd_(fd), request_type_(pkgmgr_common::REQ_TYPE_NONE), data_size_(-1) {
socket_ = std::unique_ptr<pkgmgr_common::socket::DataSocket>(
new (std::nothrow) pkgmgr_common::socket::DataSocket(fd_));
- if (socket_ == nullptr) LOGE("Out of memory");
+ if (socket_ == nullptr)
+ LOGE("Out of memory");
}
PkgRequest::~PkgRequest() {
- if (data_ != nullptr) delete[] data_;
+ if (data_ != nullptr)
+ delete[] data_;
}
-unsigned char* PkgRequest::GetData() { return data_; }
+unsigned char* PkgRequest::GetData() {
+ return data_;
+}
-int PkgRequest::GetSize() { return data_size_; }
+int PkgRequest::GetSize() {
+ return data_size_;
+}
pid_t PkgRequest::GetSenderPID() {
return socket_->GetPID();
}
-pkgmgr_common::ReqType PkgRequest::GetRequestType() { return request_type_; }
+pkgmgr_common::ReqType PkgRequest::GetRequestType() {
+ return request_type_;
+}
bool PkgRequest::ReceiveData() {
int ret = socket_->ReceiveData(&request_type_, sizeof(request_type_));
stop_all_ = true;
cv_.notify_all();
- for (auto& t : threads_) t.join();
+ for (auto& t : threads_)
+ t.join();
}
bool WorkerThread::PushQueue(std::shared_ptr<PkgRequest> req) {
{
std::unique_lock<std::mutex> u(lock_);
cv_.wait(u, [this] { return !this->queue_.empty() || stop_all_; });
- if (stop_all_ && queue_.empty()) return;
+ if (stop_all_ && queue_.empty())
+ return;
req = PopQueue();
}
void WorkerThread::SetLocale(std::string locale) {
LOGD("Change locale (%s) -> (%s)", locale_.GetObject().c_str(),
- locale.c_str());
+ locale.c_str());
locale_.SetObject(std::move(locale));
}
~WorkerThread();
bool PushQueue(std::shared_ptr<PkgRequest> req);
void SetLocale(std::string locale);
+
private:
void Run();
static void SetMemoryTrimTimer();