From: Bartlomiej Kunikowski Date: Fri, 11 Aug 2017 08:43:00 +0000 (+0200) Subject: Perform code style checking fixes X-Git-Tag: submit/tizen/20170829.115218~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f97859e652abf744308fe8178d69d364614696e;p=platform%2Fcore%2Fappfw%2Ftpk-backend.git Perform code style checking fixes Change-Id: I3745fddee0bc058ad73c272fcc4bcb61b8d31beb --- diff --git a/src/tpk/step/filesystem/step_tpk_prepare_package_directory.cc b/src/tpk/step/filesystem/step_tpk_prepare_package_directory.cc index 5f0f5e5..5f137a4 100644 --- a/src/tpk/step/filesystem/step_tpk_prepare_package_directory.cc +++ b/src/tpk/step/filesystem/step_tpk_prepare_package_directory.cc @@ -24,9 +24,9 @@ ci::Step::Status StepTpkPreparePackageDirectory::BackupDirectory( if (!bf::exists(context_->pkg_path.get() / entry)) return Status::OK; if (!ci::MoveDir(context_->pkg_path.get() / entry, backup_path, - ci::FSFlag::FS_MERGE_OVERWRITE | ci::FSFlag::FS_COMMIT_COPY_FILE)) { - LOG(ERROR) << "Failed to backup file"; - return Status::APP_DIR_ERROR; + ci::FSFlag::FS_MERGE_OVERWRITE | ci::FSFlag::FS_COMMIT_COPY_FILE)) { + LOG(ERROR) << "Failed to backup file"; + return Status::APP_DIR_ERROR; } backupPath_ = backup_path; diff --git a/src/unit_tests/smoke_test.cc b/src/unit_tests/smoke_test.cc index 049ca5f..51de2e1 100644 --- a/src/unit_tests/smoke_test.cc +++ b/src/unit_tests/smoke_test.cc @@ -17,9 +17,9 @@ class SmokeEnvironment : public testing::Environment { explicit SmokeEnvironment(ci::RequestMode mode) : request_mode_(mode) { } void SetUp() override { - if (request_mode_ == ci::RequestMode::USER) + if (request_mode_ == ci::RequestMode::USER) { ASSERT_TRUE(AddTestUser(kNormalUserName)); - else { + } else { kTestUserId = kGlobalUserUid; kTestGroupId = kGlobalUserGid; kTestUserIdStr = std::to_string(kTestUserId); diff --git a/src/unit_tests/smoke_utils.cc b/src/unit_tests/smoke_utils.cc index 0a86f20..82e7ab6 100644 --- a/src/unit_tests/smoke_utils.cc +++ b/src/unit_tests/smoke_utils.cc @@ -101,13 +101,12 @@ bool AddUser(const char *user_name) { bool DeleteUser(const char *user_name, bool rem_home_dir) { bool rval = FALSE; GumUser* guser = gum_user_get_by_name_sync(user_name, FALSE); - if(guser) + if (guser) rval = gum_user_delete_sync(guser, rem_home_dir); return rval; } -} - +} // namespace bool TouchFile(const bf::path& path) { FILE* f = fopen(path.c_str(), "w+"); @@ -185,14 +184,14 @@ bool DeleteTestUser(const char *user_name) { // User do not exist return true; DeleteUser(user_name, true); - if (boost::optional uid = ci::GetUidByUserName(user_name)); - else { + if (boost::optional uid = ci::GetUidByUserName(user_name)) { + LOG(ERROR) << "Deleting test user failed"; + return false; + } else { std::cout << "User deleted properly: user_name=" << user_name << " uid=" << test_uid << std::endl; return true; } - LOG(ERROR) << "Deleting test user failed"; - return false; } void RemoveAllRecoveryFiles() { @@ -304,7 +303,7 @@ bool ValidatePackageFS(const std::string& pkgid, const std::string&, if (bf::is_symlink(symlink_status(iter->path()))) continue; bool is_rw_dir = false; - for(const auto rw_dir : rwDirectories) { + for (const auto rw_dir : rwDirectories) { bf::path rw_dir_path = rw_dir; bf::path relative_path = ci::MakeRelativePath(iter->path(), package_path); is_rw_dir |= (relative_path == rw_dir_path); @@ -803,20 +802,19 @@ void UninstallAllSmokeApps(ci::RequestMode request_mode) { UninstallAllAppsInDirectory(apps_rw, false); } -int GetAppInstalledTime(const char *appid, uid_t uid) -{ - int ret = 0; - int installed_time = 0; - pkgmgrinfo_appinfo_h handle = NULL; - ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, uid, &handle); - if (ret != PMINFO_R_OK) - return -1; - ret = pkgmgrinfo_appinfo_get_installed_time(handle, &installed_time); - if (ret != PMINFO_R_OK) { - pkgmgrinfo_appinfo_destroy_appinfo(handle); - return -1; - } - pkgmgrinfo_appinfo_destroy_appinfo(handle); - return installed_time; +int GetAppInstalledTime(const char *appid, uid_t uid) { + int ret = 0; + int installed_time = 0; + pkgmgrinfo_appinfo_h handle = NULL; + ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, uid, &handle); + if (ret != PMINFO_R_OK) + return -1; + ret = pkgmgrinfo_appinfo_get_installed_time(handle, &installed_time); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_appinfo_destroy_appinfo(handle); + return -1; + } + pkgmgrinfo_appinfo_destroy_appinfo(handle); + return installed_time; }