diff --git a/frameworks/bundle_lite/src/bundle_manager.cpp b/frameworks/bundle_lite/src/bundle_manager.cpp index f52f02a..2a8aff0 100755 --- a/frameworks/bundle_lite/src/bundle_manager.cpp +++ b/frameworks/bundle_lite/src/bundle_manager.cpp @@ -43,7 +43,7 @@ constexpr static uint8_t OBJECT_NUMBER_IN_INSTALLATION = 1; constexpr static uint8_t OBJECT_NUMBER_IN_INSTALLATION = 2; #endif -int32 RegisterCallback(BundleStatusCallback *bundleStatusCallback) +int32_t RegisterCallback(BundleStatusCallback *bundleStatusCallback) { if ((bundleStatusCallback == nullptr) || (bundleStatusCallback->callBack == nullptr)) { return ERR_APPEXECFWK_OBJECT_NULL; @@ -57,7 +57,7 @@ int32 RegisterCallback(BundleStatusCallback *bundleStatusCallback) bundleStatusCallback->bundleName, bundleStatusCallback->data); } -int32 UnregisterCallback() +int32_t UnregisterCallback() { return OHOS::BundleCallback::GetInstance().UnregisterBundleStateCallback(); } diff --git a/interfaces/kits/bundle_lite/module_info.h b/interfaces/kits/bundle_lite/module_info.h index b78c4f0..9d6d926 100644 --- a/interfaces/kits/bundle_lite/module_info.h +++ b/interfaces/kits/bundle_lite/module_info.h @@ -84,7 +84,7 @@ typedef struct { /** Whether the HAP package is installed while the user is installing the application */ bool isDeliveryInstall; - /** + /** * Pointer to the types of devices that can run the application. The maximum size of the device type array is * {@link DEVICE_TYPE_SIZE}. */ diff --git a/services/bundlemgr_lite/bundle_daemon/src/bundle_daemon_handler.cpp b/services/bundlemgr_lite/bundle_daemon/src/bundle_daemon_handler.cpp index 0afce61..b48b498 100755 --- a/services/bundlemgr_lite/bundle_daemon/src/bundle_daemon_handler.cpp +++ b/services/bundlemgr_lite/bundle_daemon/src/bundle_daemon_handler.cpp @@ -15,9 +15,9 @@ #include "bundle_daemon_handler.h" +#include #include #include -#include #include "bundle_daemon_log.h" #include "bundle_file_utils.h" diff --git a/services/bundlemgr_lite/bundle_daemon/src/bundle_file_utils.cpp b/services/bundlemgr_lite/bundle_daemon/src/bundle_file_utils.cpp index 6422d04..95e7ad3 100644 --- a/services/bundlemgr_lite/bundle_daemon/src/bundle_file_utils.cpp +++ b/services/bundlemgr_lite/bundle_daemon/src/bundle_file_utils.cpp @@ -15,9 +15,9 @@ #include "bundle_file_utils.h" +#include #include #include -#include #include #include diff --git a/services/bundlemgr_lite/include/bundle_extractor.h b/services/bundlemgr_lite/include/bundle_extractor.h index ade3178..cbfec2d 100755 --- a/services/bundlemgr_lite/include/bundle_extractor.h +++ b/services/bundlemgr_lite/include/bundle_extractor.h @@ -16,7 +16,6 @@ #ifndef OHOS_BUNDLE_EXTRACTOR_H #define OHOS_BUNDLE_EXTRACTOR_H -#include "stdint.h" #include #include diff --git a/services/bundlemgr_lite/include/gt_bundle_extractor.h b/services/bundlemgr_lite/include/gt_bundle_extractor.h index 037a156..e504de9 100644 --- a/services/bundlemgr_lite/include/gt_bundle_extractor.h +++ b/services/bundlemgr_lite/include/gt_bundle_extractor.h @@ -17,7 +17,6 @@ #define OHOS_GT_BUNDLE_EXTRACTOR_H #include "bundle_common.h" -#include "stdint.h" namespace OHOS { class GtBundleExtractor { diff --git a/services/bundlemgr_lite/include/gt_bundle_installer.h b/services/bundlemgr_lite/include/gt_bundle_installer.h index 9e3a750..c373b35 100755 --- a/services/bundlemgr_lite/include/gt_bundle_installer.h +++ b/services/bundlemgr_lite/include/gt_bundle_installer.h @@ -65,7 +65,6 @@ private: uint8_t AddBundleResList(const char *bundleName, uint32_t labelId, uint32_t iconId); uint8_t MoveRawFileToDataPath(const BundleInfo *bundleInfo); uint8_t TransformJsToBc(const char *codePath, InstallRecord &record); - }; #define FREE_PRO_RESOURCE(fp, permissions, bundleInfo) \ diff --git a/services/bundlemgr_lite/src/bundle_ms_feature.cpp b/services/bundlemgr_lite/src/bundle_ms_feature.cpp index 66148ca..785545f 100755 --- a/services/bundlemgr_lite/src/bundle_ms_feature.cpp +++ b/services/bundlemgr_lite/src/bundle_ms_feature.cpp @@ -121,7 +121,7 @@ BOOL BundleMsFeature::OnFeatureMessage(Feature *feature, Request *request) return TRUE; } -void static InnerFreeDataBuff(void *ptr) +static void InnerFreeDataBuff(void *ptr) { if (ptr != nullptr) { cJSON_free(ptr); diff --git a/services/bundlemgr_lite/src/bundle_util.cpp b/services/bundlemgr_lite/src/bundle_util.cpp index 80c5049..fbf1903 100755 --- a/services/bundlemgr_lite/src/bundle_util.cpp +++ b/services/bundlemgr_lite/src/bundle_util.cpp @@ -29,14 +29,14 @@ #else #include "adapter.h" #include "bundlems_log.h" +#include "cstdio" #include "dirent.h" #include "fcntl.h" #include "los_tick.h" -#include "stdio.h" #include "sys/stat.h" #include "unistd.h" #endif -#include +#include #include "utils.h" namespace OHOS { @@ -201,7 +201,7 @@ uint32_t BundleUtil::GetFileFolderSize(const char *filePath) list->PushFront(Utils::Strdup(filePath)); uint32_t fileFolderSize = 0; - while(!list->IsEmpty()) { + while (!list->IsEmpty()) { char *curPath = list->Front(); if (curPath == nullptr) { break; diff --git a/services/bundlemgr_lite/src/gt_bundle_installer.cpp b/services/bundlemgr_lite/src/gt_bundle_installer.cpp index 1376143..1c1bfb3 100755 --- a/services/bundlemgr_lite/src/gt_bundle_installer.cpp +++ b/services/bundlemgr_lite/src/gt_bundle_installer.cpp @@ -25,13 +25,13 @@ extern "C" { #include "appexecfwk_errors.h" #include "bundle_util.h" #include "bundlems_log.h" +#include "cstdio" #include "dirent.h" #include "fcntl.h" #include "global.h" #include "gt_bundle_extractor.h" #include "gt_bundle_manager_service.h" #include "gt_bundle_parser.h" -#include "stdio.h" #include "sys/stat.h" #include "unistd.h" #include "utils.h" @@ -201,7 +201,8 @@ uint8_t GtBundleInstaller::Install(const char *path, InstallerCallback installer if (errorCode != ERR_OK) { return errorCode; } - (void) GtManagerService::GetInstance().ReportInstallCallback(OPERATION_DOING, 0, BMS_SIXTH_FINISHED_PROCESS, installerCallback); + (void) GtManagerService::GetInstance().ReportInstallCallback(OPERATION_DOING, + 0, BMS_SIXTH_FINISHED_PROCESS, installerCallback); // rename bundle.json if (!RenameJsonFile(installRecord.bundleName, randStr)) { @@ -234,10 +235,12 @@ uint8_t GtBundleInstaller::ProcessBundleInstall(const char *path, const char *ra .bundleName = nullptr, .moduleDescriptionId = 0, .abilityRes = nullptr, .totalNumOfAbilityRes = 0 }; BundleInfo *bundleInfo = nullptr; - (void) GtManagerService::GetInstance().ReportInstallCallback(OPERATION_DOING, 0, BMS_FIRST_FINISHED_PROCESS, installerCallback); + (void) GtManagerService::GetInstance().ReportInstallCallback(OPERATION_DOING, 0, + BMS_FIRST_FINISHED_PROCESS, installerCallback); uint8_t errorCode = PreCheckBundle(path, fp, signatureInfo, fileSize, bundleStyle); CHECK_PRO_RESULT(errorCode, fp, permissions, bundleInfo, signatureInfo); - (void) GtManagerService::GetInstance().ReportInstallCallback(OPERATION_DOING, 0, BMS_SECOND_FINISHED_PROCESS, installerCallback); + (void) GtManagerService::GetInstance().ReportInstallCallback(OPERATION_DOING, + 0, BMS_SECOND_FINISHED_PROCESS, installerCallback); #ifdef __LITEOS_M__ fp = open(path, O_RDONLY, S_IREAD); if (fp < 0) { @@ -273,7 +276,8 @@ uint8_t GtBundleInstaller::ProcessBundleInstall(const char *path, const char *ra errorCode = GtBundleExtractor::ExtractHap(tmpCodePath, installRecord.bundleName, fp, fileSize, bundleStyle); close(fp); CHECK_PRO_PART_ROLLBACK(errorCode, tmpCodePath, permissions, bundleInfo, signatureInfo); - (void) GtManagerService::GetInstance().ReportInstallCallback(OPERATION_DOING, 0, BMS_THIRD_FINISHED_PROCESS, installerCallback); + (void) GtManagerService::GetInstance().ReportInstallCallback(OPERATION_DOING, 0, + BMS_THIRD_FINISHED_PROCESS, installerCallback); // get js engine version #ifdef BC_TRANS_ENABLE char *jsEngineVersion = get_jerry_version_no(); @@ -284,7 +288,8 @@ uint8_t GtBundleInstaller::ProcessBundleInstall(const char *path, const char *ra errorCode = TransformJsToBc(tmpCodePath, installRecord); CHECK_PRO_PART_ROLLBACK(errorCode, tmpCodePath, permissions, bundleInfo, signatureInfo); #endif - (void) GtManagerService::GetInstance().ReportInstallCallback(OPERATION_DOING, 0, BMS_FOURTH_FINISHED_PROCESS, installerCallback); + (void) GtManagerService::GetInstance().ReportInstallCallback(OPERATION_DOING, 0, + BMS_FOURTH_FINISHED_PROCESS, installerCallback); // rename install path and record install infomation bool isUpdate = GtManagerService::GetInstance().QueryBundleInfo(installRecord.bundleName) != nullptr; errorCode = HandleFileAndBackUpRecord(installRecord, tmpCodePath, randStr, bundleInfo->dataPath, isUpdate); @@ -294,7 +299,8 @@ uint8_t GtBundleInstaller::ProcessBundleInstall(const char *path, const char *ra // move rawfile to data path when rawfile is exists errorCode = MoveRawFileToDataPath(bundleInfo); CHECK_PRO_ROLLBACK(errorCode, permissions, bundleInfo, signatureInfo, randStr); - (void) GtManagerService::GetInstance().ReportInstallCallback(OPERATION_DOING, 0, BMS_FIFTH_FINISHED_PROCESS, installerCallback); + (void) GtManagerService::GetInstance().ReportInstallCallback(OPERATION_DOING, 0, + BMS_FIFTH_FINISHED_PROCESS, installerCallback); // store permissions errorCode = StorePermissions(installRecord.bundleName, permissions.permissionTrans, permissions.permNum, isUpdate); diff --git a/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp b/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp index e7467f6..99b3717 100755 --- a/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp +++ b/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp @@ -23,6 +23,7 @@ #include "bundle_util.h" #include "bundlems_log.h" #include "cmsis_os2.h" +#include "cstdio" #include "dirent.h" #include "fcntl.h" #include "gt_bundle_extractor.h" @@ -30,7 +31,6 @@ #include "gt_extractor_util.h" #include "jerryscript_adapter.h" #include "los_tick.h" -#include "stdio.h" #include "sys/stat.h" #include "unistd.h" #include "utils.h" @@ -100,7 +100,6 @@ bool GtManagerService::Install(const char *hapPath, const InstallParam *installP uint8_t ret = GtBundleExtractor::ExtractInstallMsg(path, &(bundleInstallMsg_->bundleName), &(bundleInstallMsg_->label), &(bundleInstallMsg_->smallIconPath), &(bundleInstallMsg_->bigIconPath)); - if (ret != 0) { char *name = strchr(path, '/'); bundleInstallMsg_->bundleName = Utils::Strdup(name + 1); diff --git a/services/bundlemgr_lite/src/gt_bundle_parser.cpp b/services/bundlemgr_lite/src/gt_bundle_parser.cpp index 17cb8d6..c52fe44 100755 --- a/services/bundlemgr_lite/src/gt_bundle_parser.cpp +++ b/services/bundlemgr_lite/src/gt_bundle_parser.cpp @@ -490,7 +490,8 @@ bool GtBundleParser::ConvertIconResToBundleInfo(const char *resPath, uint32_t ic return false; } char *pos = relativeIconPath + strlen(relativeIconPath); - for (; *pos != '/'; pos--) {}; + for (; *pos != '/'; pos--) { + }; *pos = '\0'; char *bigIconPathComp[] = { bundleInfo->codePath, const_cast(ASSETS), relativeIconPath, const_cast(ICON_NAME) diff --git a/services/bundlemgr_lite/src/gt_extractor_util.cpp b/services/bundlemgr_lite/src/gt_extractor_util.cpp index 02ab2c5..3c10d01 100755 --- a/services/bundlemgr_lite/src/gt_extractor_util.cpp +++ b/services/bundlemgr_lite/src/gt_extractor_util.cpp @@ -15,14 +15,14 @@ #include "gt_extractor_util.h" -#include +#include #include "appexecfwk_errors.h" #include "bundle_common.h" #include "bundle_util.h" #include "bundlems_log.h" +#include "cstdio" #include "dirent.h" #include "fcntl.h" -#include "stdio.h" #include "sys/stat.h" #include "unistd.h" #include "utils.h" diff --git a/services/bundlemgr_lite/src/zip_file.cpp b/services/bundlemgr_lite/src/zip_file.cpp index ef94529..4e41678 100755 --- a/services/bundlemgr_lite/src/zip_file.cpp +++ b/services/bundlemgr_lite/src/zip_file.cpp @@ -26,13 +26,13 @@ namespace OHOS { namespace { -#define ZIPPOS_ADD_AND_CHECK_OVERFLOW(first, second, sum) \ -{ \ - if ((second > 0) && (first > (std::numeric_limits::max() - second))) { \ - return false; \ - } \ - sum = first + second; \ -} +#define ZIPPOS_ADD_AND_CHECK_OVERFLOW(first, second, sum) \ + do { \ + if ((second > 0) && (first > (std::numeric_limits::max() - second))) { \ + return false; \ + } \ + sum = first + second; \ + } while (0) constexpr uint32_t MAX_FILE_NAME = 256; constexpr uint32_t UNZIP_BUFFER_SIZE = 1024;