Remove of unnecessary copy operation from auto
Change-Id: I9e76b2a9f4a18a1c8170a981b87e538590c6a64c
Signed-off-by: ilho kim <ilho159.kim@samsung.com>
LOG(ERROR) << "Cannot create pkgmgr_instcertinfo_h";
return false;
}
LOG(ERROR) << "Cannot create pkgmgr_instcertinfo_h";
return false;
}
- for (auto pair : kCertTypePairs) {
+ for (const auto& pair : kCertTypePairs) {
auto cert = (cert_info.*(pair.first)).get();
auto type = pair.second;
if (!RegisterCertificate(handle, cert, type))
auto cert = (cert_info.*(pair.first)).get();
auto type = pair.second;
if (!RegisterCertificate(handle, cert, type))
if (request_type_ == ci::RequestType::Uninstall) {
if (!SendAppids(type, pkgid))
return false;
if (request_type_ == ci::RequestType::Uninstall) {
if (!SendAppids(type, pkgid))
return false;
- for (auto l : user_list_)
+ for (const auto& l : user_list_)
SendAppids(l.first, type, pkgid);
}
SendAppids(l.first, type, pkgid);
}
if (!SendSignal(PKGMGR_INSTALLER_INSTALL_PERCENT_KEY_STR,
std::to_string(progress).c_str(), type, pkgid))
return false;
if (!SendSignal(PKGMGR_INSTALLER_INSTALL_PERCENT_KEY_STR,
std::to_string(progress).c_str(), type, pkgid))
return false;
- for (auto l : user_list_) {
+ for (const auto& l : user_list_) {
// ignore error case
SendSignal(l.first, PKGMGR_INSTALLER_INSTALL_PERCENT_KEY_STR,
std::to_string(progress).c_str(), type, pkgid);
// ignore error case
SendSignal(l.first, PKGMGR_INSTALLER_INSTALL_PERCENT_KEY_STR,
std::to_string(progress).c_str(), type, pkgid);
PKGMGR_INSTALLER_END_KEY_STR, GetResultKey(result), type, pkgid))
return false;
PKGMGR_INSTALLER_END_KEY_STR, GetResultKey(result), type, pkgid))
return false;
- for (auto l : user_list_)
+ for (const auto& l : user_list_)
SendSignal(l.first,
PKGMGR_INSTALLER_END_KEY_STR, GetResultKey(result), type, pkgid);
SendSignal(l.first,
PKGMGR_INSTALLER_END_KEY_STR, GetResultKey(result), type, pkgid);
type,
pkgid))
return false;
type,
pkgid))
return false;
- for (auto l : user_list_)
+ for (const auto& l : user_list_)
SendSignal(l.first,
PKGMGR_INSTALLER_ERROR_KEY_STR,
error_value.c_str(),
SendSignal(l.first,
PKGMGR_INSTALLER_ERROR_KEY_STR,
error_value.c_str(),
return true;
name = GetFunctionName(ActionType::Removed);
return true;
name = GetFunctionName(ActionType::Removed);
- for (auto appid : appid_list) {
+ for (const auto& appid : appid_list) {
int result = 0;
Exec(name, &result, manifest->package, appid, nullptr);
if (result) {
int result = 0;
Exec(name, &result, manifest->package, appid, nullptr);
if (result) {
name = GetFunctionName(action_type);
else
name = GetFunctionName(ActionType::Removed);
name = GetFunctionName(action_type);
else
name = GetFunctionName(ActionType::Removed);
- for (auto appid : appid_list_) {
+ for (const auto& appid : appid_list_) {
int result = 0;
Exec(name, &result, manifest->package, appid.c_str(), nullptr);
if (result) {
int result = 0;
Exec(name, &result, manifest->package, appid.c_str(), nullptr);
if (result) {
return false;
std::vector<std::string> shared_dirs(kSharedDataEntries);
return false;
std::vector<std::string> shared_dirs(kSharedDataEntries);
- for (auto entry : shared_dirs) {
+ for (const auto& entry : shared_dirs) {
if (!ci::RemoveAll(path / entry / pkgid))
return false;
}
if (!ci::RemoveAll(path / entry / pkgid))
return false;
}
bool PerformExternalDirectoryCreationForAllUsers(const std::string& pkgid) {
UserList list = ci::GetUserList();
bool PerformExternalDirectoryCreationForAllUsers(const std::string& pkgid) {
UserList list = ci::GetUserList();
+ for (const auto& l : list) {
if (!PerformExternalDirectoryCreationForUser(std::get<0>(l),
pkgid))
LOG(WARNING) << "Could not create external storage directories for user: "
if (!PerformExternalDirectoryCreationForUser(std::get<0>(l),
pkgid))
LOG(WARNING) << "Could not create external storage directories for user: "
bool PerformExternalDirectoryCreationForAllPkgs() {
UserList list = ci::GetUserList();
bool PerformExternalDirectoryCreationForAllPkgs() {
UserList list = ci::GetUserList();
+ for (const auto& l : list) {
uid_t uid = std::get<0>(l);
pkgmgrinfo_pkginfo_filter_h filter_handle = nullptr;
int ret = pkgmgrinfo_pkginfo_filter_create(&filter_handle);
uid_t uid = std::get<0>(l);
pkgmgrinfo_pkginfo_filter_h filter_handle = nullptr;
int ret = pkgmgrinfo_pkginfo_filter_create(&filter_handle);
bool PerformExternalDirectoryDeletionForAllUsers(const std::string& pkgid) {
UserList list = ci::GetUserList();
bool PerformExternalDirectoryDeletionForAllUsers(const std::string& pkgid) {
UserList list = ci::GetUserList();
+ for (const auto& l : list) {
uid_t uid = std::get<0>(l);
ci::PkgQueryInterface pkg_query(pkgid, uid);
LOG(DEBUG) << "Deleting directories for user: " << uid;
uid_t uid = std::get<0>(l);
ci::PkgQueryInterface pkg_query(pkgid, uid);
LOG(DEBUG) << "Deleting directories for user: " << uid;
// create per user dir
UserList list = ci::GetUserList();
// create per user dir
UserList list = ci::GetUserList();
+ for (const auto& l : list) {
uid_t uid = std::get<0>(l);
bf::path owner_apps_rw = std::get<2>(l) / "apps_rw";
std::vector<bf::path> apps_rw_paths;
uid_t uid = std::get<0>(l);
bf::path owner_apps_rw = std::get<2>(l) / "apps_rw";
std::vector<bf::path> apps_rw_paths;
if (shareddata) {
std::vector<std::string> shared_dirs(kSharedDataEntries);
if (shareddata) {
std::vector<std::string> shared_dirs(kSharedDataEntries);
- for (auto entry : shared_dirs) {
+ for (const auto& entry : shared_dirs) {
bf::path shared_dst = apps_rw / entry / pkgid;
if (!::SetPackageDirectoryOwnerAndPermissions(shared_dst, uid))
return false;
bf::path shared_dst = apps_rw / entry / pkgid;
if (!::SetPackageDirectoryOwnerAndPermissions(shared_dst, uid))
return false;
// delete per user dir
UserList list = ci::GetUserList();
// delete per user dir
UserList list = ci::GetUserList();
+ for (const auto& l : list) {
uid_t uid = std::get<0>(l);
bf::path owner_apps_rw = std::get<2>(l) / "apps_rw";
std::vector<bf::path> apps_rw_paths;
uid_t uid = std::get<0>(l);
bf::path owner_apps_rw = std::get<2>(l) / "apps_rw";
std::vector<bf::path> apps_rw_paths;
if (shareddata) {
std::vector<std::string> shared_dirs(kSharedDataEntries);
if (shareddata) {
std::vector<std::string> shared_dirs(kSharedDataEntries);
- for (auto entry : shared_dirs) {
+ for (const auto& entry : shared_dirs) {
bf::path shared_dst = path / entry / pkgid;
if (!::SetPackageDirectoryOwnerAndPermissions(shared_dst, uid))
return false;
bf::path shared_dst = path / entry / pkgid;
if (!::SetPackageDirectoryOwnerAndPermissions(shared_dst, uid))
return false;
bool DeleteUserExternalDirectories(const std::string& pkgid) {
UserList list = ci::GetUserList();
bool DeleteUserExternalDirectories(const std::string& pkgid) {
UserList list = ci::GetUserList();
+ for (const auto& l : list) {
uid_t uid = std::get<0>(l);
ci::PkgQueryInterface pkg_query(pkgid, uid);
if (pkg_query.IsPackageInstalled()) {
uid_t uid = std::get<0>(l);
ci::PkgQueryInterface pkg_query(pkgid, uid);
if (pkg_query.IsPackageInstalled()) {
}
UserList list = ci::GetUserList();
}
UserList list = ci::GetUserList();
+ for (const auto& l : list) {
uid_t uid = std::get<0>(l);
LOG(DEBUG) << "Creating symlinks for uid: " << uid;
// check installed user private app.
uid_t uid = std::get<0>(l);
LOG(DEBUG) << "Creating symlinks for uid: " << uid;
// check installed user private app.
}
UserList list = ci::GetUserList();
}
UserList list = ci::GetUserList();
+ for (const auto& l : list) {
uid_t uid = std::get<0>(l);
LOG(DEBUG) << "Deleting symlinks for uid: " << uid;
uid_t uid = std::get<0>(l);
LOG(DEBUG) << "Deleting symlinks for uid: " << uid;
// create per user dir
ci::UserList list = ci::GetUserList();
// create per user dir
ci::UserList list = ci::GetUserList();
+ for (const auto& l : list) {
uid_t uid = std::get<0>(l);
LOG(DEBUG) << "Adding shareddata directory for uid: " << uid;
uid_t uid = std::get<0>(l);
LOG(DEBUG) << "Adding shareddata directory for uid: " << uid;
return false;
std::vector<std::string> shared_dirs(kSharedDataEntries);
return false;
std::vector<std::string> shared_dirs(kSharedDataEntries);
- for (auto entry : shared_dirs) {
+ for (const auto& entry : shared_dirs) {
bf::path shared_dst = apps_rw / entry / pkgid;
if (!::SetPackageDirectoryOwnerAndPermissions(shared_dst, uid))
return false;
bf::path shared_dst = apps_rw / entry / pkgid;
if (!::SetPackageDirectoryOwnerAndPermissions(shared_dst, uid))
return false;
return false;
ci::UserList list = ci::GetUserList();
return false;
ci::UserList list = ci::GetUserList();
+ for (const auto& l : list) {
uid_t uid = std::get<0>(l);
bf::path owner_apps_rw = ci::GetRootAppPath(false, uid);
uid_t uid = std::get<0>(l);
bf::path owner_apps_rw = ci::GetRootAppPath(false, uid);
return false;
ci::UserList list = ci::GetUserList();
return false;
ci::UserList list = ci::GetUserList();
+ for (const auto& l : list) {
uid_t uid = std::get<0>(l);
bf::path owner_apps_rw = ci::GetRootAppPath(false, uid);
std::vector<bf::path> apps_rw_paths;
uid_t uid = std::get<0>(l);
bf::path owner_apps_rw = ci::GetRootAppPath(false, uid);
std::vector<bf::path> apps_rw_paths;
return false;
std::vector<std::string> shared_dirs(kSharedDataEntries);
return false;
std::vector<std::string> shared_dirs(kSharedDataEntries);
- for (auto entry : shared_dirs) {
+ for (const auto& entry : shared_dirs) {
bf::path shared_dst = apps_rw / entry / pkgid;
if (!::SetPackageDirectoryOwnerAndPermissions(shared_dst, uid))
return false;
bf::path shared_dst = apps_rw / entry / pkgid;
if (!::SetPackageDirectoryOwnerAndPermissions(shared_dst, uid))
return false;
std::string error_message;
ci::UserList list = ci::GetUserList();
std::string error_message;
ci::UserList list = ci::GetUserList();
+ for (const auto& l : list) {
uid_t uid = std::get<0>(l);
bf::path owner_apps_rw = ci::GetRootAppPath(false, uid);
std::vector<bf::path> apps_rw_paths;
uid_t uid = std::get<0>(l);
bf::path owner_apps_rw = ci::GetRootAppPath(false, uid);
std::vector<bf::path> apps_rw_paths;
return false;
std::vector<std::string> shared_dirs(kSharedDataEntries);
return false;
std::vector<std::string> shared_dirs(kSharedDataEntries);
- for (auto entry : shared_dirs) {
+ for (const auto& entry : shared_dirs) {
bf::path shared_dst = apps_rw / entry / pkgid;
if (!::SetPackageDirectoryOwnerAndPermissions(shared_dst, uid))
return false;
bf::path shared_dst = apps_rw / entry / pkgid;
if (!::SetPackageDirectoryOwnerAndPermissions(shared_dst, uid))
return false;
return false;
ci::UserList list = ci::GetUserList();
return false;
ci::UserList list = ci::GetUserList();
+ for (const auto& l : list) {
uid_t uid = std::get<0>(l);
bf::path owner_apps_rw = ci::GetRootAppPath(false, uid);
std::vector<bf::path> apps_rw_paths;
uid_t uid = std::get<0>(l);
bf::path owner_apps_rw = ci::GetRootAppPath(false, uid);
std::vector<bf::path> apps_rw_paths;
return Step::Status::OK;
UserList list = ci::GetUserList();
return Step::Status::OK;
UserList list = ci::GetUserList();
+ for (const auto& l : list) {
uid_t uid = std::get<0>(l);
bf::path owner_apps_rw(std::get<2>(l) / "apps_rw");
std::vector<bf::path> apps_rw_paths;
uid_t uid = std::get<0>(l);
bf::path owner_apps_rw(std::get<2>(l) / "apps_rw");
std::vector<bf::path> apps_rw_paths;
}
case RequestMode::GLOBAL: {
UserList list = GetUserList();
}
case RequestMode::GLOBAL: {
UserList list = GetUserList();
+ for (const auto& l : list) {
uid_t uid = std::get<0>(l);
PkgQueryInterface pkg_query(context_->pkgid.get(), uid);
if (pkg_query.IsPackageInstalled(RequestMode::USER)) {
uid_t uid = std::get<0>(l);
PkgQueryInterface pkg_query(context_->pkgid.get(), uid);
if (pkg_query.IsPackageInstalled(RequestMode::USER)) {
Step::Status StepRemovePrivSharedres::OfflineRemove() {
if (context_->request_mode.get() == RequestMode::GLOBAL) {
common_installer::UserList user_list = common_installer::GetUserList();
Step::Status StepRemovePrivSharedres::OfflineRemove() {
if (context_->request_mode.get() == RequestMode::GLOBAL) {
common_installer::UserList user_list = common_installer::GetUserList();
- for (auto l : user_list) {
+ for (const auto& l : user_list) {
uid_t uid = std::get<0>(l);
if (!RemoveResForUid(context_->pkgid.get(), uid))
return Status::ERROR;
uid_t uid = std::get<0>(l);
if (!RemoveResForUid(context_->pkgid.get(), uid))
return Status::ERROR;
Step::Status StepRemovePrivSharedres::RequestRemove() {
if (context_->request_mode.get() == RequestMode::GLOBAL) {
common_installer::UserList user_list = common_installer::GetUserList();
Step::Status StepRemovePrivSharedres::RequestRemove() {
if (context_->request_mode.get() == RequestMode::GLOBAL) {
common_installer::UserList user_list = common_installer::GetUserList();
- for (auto l : user_list) {
+ for (const auto& l : user_list) {
uid_t uid = std::get<0>(l);
int ret = SendUninstallRequest(context_->pkgid.get(), uid);
if (ret == PKGMGR_R_OK) {
uid_t uid = std::get<0>(l);
int ret = SendUninstallRequest(context_->pkgid.get(), uid);
if (ret == PKGMGR_R_OK) {
// recover normal user packages
ci::UserList list = ci::GetUserList();
// recover normal user packages
ci::UserList list = ci::GetUserList();
- for (auto userinfo : list) {
+ for (const auto& userinfo : list) {
uid_t uid = std::get<0>(userinfo);
LOG(INFO) << "Searching recovery files for user " << std::get<0>(userinfo);
SearchBackupFiles(uid);
uid_t uid = std::get<0>(userinfo);
LOG(INFO) << "Searching recovery files for user " << std::get<0>(userinfo);
SearchBackupFiles(uid);
void PkgRecoveryService::ProcessRecovery(uid_t uid,
const std::vector<RecoverEntry>& entries) {
LOG(INFO) << "Process recovery for user " << uid;
void PkgRecoveryService::ProcessRecovery(uid_t uid,
const std::vector<RecoverEntry>& entries) {
LOG(INFO) << "Process recovery for user " << uid;
- for (auto entry : entries) {
+ for (const auto& entry : entries) {
const char* type = entry.first.c_str();
const char* file = entry.second.c_str();
if (!bf::exists(file))
const char* type = entry.first.c_str();
const char* file = entry.second.c_str();
if (!bf::exists(file))