diff --git a/interfaces/kits/bundle_lite/bundle_manager.h b/interfaces/kits/bundle_lite/bundle_manager.h index c55791cab45ca3d7b5fed84e54d7cfe129c35235..9c4169a38610dead19cfbb7a1a58bf3d76216b6a 100755 --- a/interfaces/kits/bundle_lite/bundle_manager.h +++ b/interfaces/kits/bundle_lite/bundle_manager.h @@ -94,7 +94,7 @@ int32_t RegisterCallback(BundleStatusCallback *BundleStatusCallback); * @since 1.0 * @version 1.0 */ -int32_t UnregisterCallback(); +int32_t UnregisterCallback(void); /** * @brief Installs or updates an application. diff --git a/services/bundlemgr_lite/include/bundle_extractor.h b/services/bundlemgr_lite/include/bundle_extractor.h index ade31787fca31e8aad53cc0f6cb7fc2900b6918b..9e969ac0c865d9cbb59b26108eb35b424459f8ab 100755 --- a/services/bundlemgr_lite/include/bundle_extractor.h +++ b/services/bundlemgr_lite/include/bundle_extractor.h @@ -16,9 +16,9 @@ #ifndef OHOS_BUNDLE_EXTRACTOR_H #define OHOS_BUNDLE_EXTRACTOR_H -#include "stdint.h" #include #include +#include "stdint.h" namespace OHOS { class BundleExtractor { diff --git a/services/bundlemgr_lite/include/bundle_installer.h b/services/bundlemgr_lite/include/bundle_installer.h index b9945ff9326ed63b1eecf90a2611ed3a96794f02..db64b2569ac4712913d9583f8976077ecd4be1a8 100755 --- a/services/bundlemgr_lite/include/bundle_installer.h +++ b/services/bundlemgr_lite/include/bundle_installer.h @@ -70,9 +70,9 @@ private: #define CHECK_PRO_RESULT(errcode, bundleInfo, permissions, abilityRes) \ do { \ - if (errcode != ERR_OK) { \ + if ((errcode) != ERR_OK) { \ BundleInfoUtils::FreeBundleInfo(bundleInfo); \ - AdapterFree(permissions.permissionTrans); \ + AdapterFree((permissions).permissionTrans); \ AdapterFree(abilityRes); \ return errcode; \ } \ @@ -80,19 +80,19 @@ private: #define CLEAR_INSTALL_ENV(bundleInfo) \ do { \ - if (bundleInfo != nullptr) { \ + if ((bundleInfo) != nullptr) { \ BundleDaemonClient::GetInstance().RemoveInstallDirectory( \ - bundleInfo->codePath, bundleInfo->dataPath, false); \ + (bundleInfo)->codePath, (bundleInfo)->dataPath, false); \ BundleInfoUtils::FreeBundleInfo(bundleInfo); \ } \ } while (0) #define CHECK_PRO_PART_ROLLBACK(errcode, path, permissions, bundleInfo, abilityRes) \ do { \ - if (errcode != ERR_OK && bundleInfo != nullptr) { \ - BundleDaemonClient::GetInstance().RemoveFile(path.c_str()); \ + if ((errcode) != ERR_OK && (bundleInfo) != nullptr) { \ + BundleDaemonClient::GetInstance().RemoveFile((path).c_str()); \ BundleInfoUtils::FreeBundleInfo(bundleInfo); \ - AdapterFree(permissions.permissionTrans); \ + AdapterFree((permissions).permissionTrans); \ AdapterFree(abilityRes); \ return errcode; \ } \ @@ -100,11 +100,11 @@ private: #define CHECK_PRO_ROLLBACK(errcode, permissions, bundleInfo, abilityRes, randStr) \ do { \ - if (errcode != ERR_OK && bundleInfo != nullptr) { \ - AdapterFree(permissions.permissionTrans); \ + if ((errcode) != ERR_OK && (bundleInfo) != nullptr) { \ + AdapterFree((permissions).permissionTrans); \ AdapterFree(abilityRes); \ - ManagerService::GetInstance().RemoveBundleInfo(bundleInfo->bundleName); \ - BundleUtil::DeleteJsonFile(bundleInfo->bundleName, randStr); \ + ManagerService::GetInstance().RemoveBundleInfo((bundleInfo)->bundleName); \ + BundleUtil::DeleteJsonFile((bundleInfo)->bundleName, randStr); \ CLEAR_INSTALL_ENV(bundleInfo); \ return errcode; \ } \ diff --git a/services/bundlemgr_lite/include/bundle_parser.h b/services/bundlemgr_lite/include/bundle_parser.h index 51dfa6637c06dc8033068604ec9d55af89a2251a..6d3e750b73bf30981c2899d60ed3623e5c6f6480 100755 --- a/services/bundlemgr_lite/include/bundle_parser.h +++ b/services/bundlemgr_lite/include/bundle_parser.h @@ -71,14 +71,14 @@ private: #define CHECK_NULL(object, errorCode) \ do { \ - if (object == nullptr) { \ + if ((object) == nullptr) { \ return errorCode; \ } \ } while (0) #define CHECK_LENGTH(length, maxLength, errorCode) \ do { \ - if (length > maxLength) { \ + if ((length) > (maxLength)) { \ return errorCode; \ } \ } while (0) @@ -92,7 +92,7 @@ private: #define CHECK_PARSE_RESULT(errorCode, object, bundleProfile) \ do { \ - if (errorCode != ERR_OK) { \ + if ((errorCode) != ERR_OK) { \ FREE_BUNDLE_PROFILE(bundleProfile); \ cJSON_Delete(object); \ return errorCode; \ @@ -101,9 +101,9 @@ private: #define FREE_BUNDLE_PROFILE(bundleProfile) \ do { \ - AdapterFree(bundleProfile.abilityInfos); \ + AdapterFree((bundleProfile).abilityInfos); \ for (uint8_t i = 0; i < METADATA_SIZE; i++) { \ - AdapterFree(bundleProfile.moduleInfo.metaData[i]); \ + AdapterFree((bundleProfile).moduleInfo.metaData[i]); \ } \ } while (0) } // namespace OHOS diff --git a/services/bundlemgr_lite/include/bundlems_log.h b/services/bundlemgr_lite/include/bundlems_log.h index 933673cafb2c22485a15dbc0ce8bc71e3e8f1d3e..20d3b022f22e91f994bfb8c6709818ad8050d264 100755 --- a/services/bundlemgr_lite/include/bundlems_log.h +++ b/services/bundlemgr_lite/include/bundlems_log.h @@ -64,7 +64,7 @@ namespace OHOS { #define CHECK_NULLPTR_RETURN_PTR(point, name, fmt) \ do { \ - if (point == nullptr) { \ + if ((point) == nullptr) { \ PRINTE(name, fmt); \ return nullptr; \ } \ @@ -72,7 +72,7 @@ namespace OHOS { #define CHECK_NULLPTR_RETURN(point, name, fmt) \ do { \ - if (point == nullptr) { \ + if ((point) == nullptr) { \ PRINTE(name, fmt); \ return; \ } \ @@ -80,7 +80,7 @@ namespace OHOS { #define CHECK_NULLPTR_RETURN_CODE(point, name, fmt, code) \ do { \ - if (point == nullptr) { \ + if ((point) == nullptr) { \ PRINTE(name, fmt); \ return code; \ } \ diff --git a/services/bundlemgr_lite/include/gt_bundle_installer.h b/services/bundlemgr_lite/include/gt_bundle_installer.h index ed558e541c792c9ae8ebaf0372c50a78b7fb5ff5..3225fcb86f1132592f03eb494b0784d7aa5a84ad 100755 --- a/services/bundlemgr_lite/include/gt_bundle_installer.h +++ b/services/bundlemgr_lite/include/gt_bundle_installer.h @@ -71,23 +71,23 @@ private: #define FREE_PRO_RESOURCE(fp, permissions, bundleInfo) \ do { \ - if (fp >= 0) { \ + if ((fp) >= 0) { \ close(fp); \ } \ BundleInfoUtils::FreeBundleInfo(bundleInfo); \ - UI_Free(permissions.permissionTrans); \ + UI_Free((permissions).permissionTrans); \ } while (0) #define FREE_SIGNATUREINFO(signatureInfo) \ do { \ AdapterFree(signatureInfo.appId); \ AdapterFree(signatureInfo.bundleName); \ - BundleUtil::FreeStrArrayMemory(signatureInfo.restricPermission, signatureInfo.restricNum); \ + BundleUtil::FreeStrArrayMemory((signatureInfo).restricPermission, (signatureInfo).restricNum); \ } while (0) #define CHECK_PRO_RESULT(errcode, fp, permissions, bundleInfo, signatureInfo) \ do { \ - if (errcode != ERR_OK) { \ + if ((errcode) != ERR_OK) { \ FREE_PRO_RESOURCE(fp, permissions, bundleInfo); \ FREE_SIGNATUREINFO(signatureInfo); \ return errcode; \ @@ -97,31 +97,31 @@ private: #define CLEAR_INSTALL_ENV(bundleInfo) \ do { \ if (bundleInfo != nullptr) { \ - BundleUtil::RemoveDir(bundleInfo->codePath); \ - BundleUtil::RemoveDir(bundleInfo->dataPath); \ + BundleUtil::RemoveDir((bundleInfo)->codePath); \ + BundleUtil::RemoveDir((bundleInfo)->dataPath); \ BundleInfoUtils::FreeBundleInfo(bundleInfo); \ } \ } while (0) #define CHECK_PRO_PART_ROLLBACK(errcode, path, permissions, bundleInfo, signatureInfo) \ do { \ - if (errcode != ERR_OK) { \ + if ((errcode) != ERR_OK) { \ BundleUtil::RemoveDir(path); \ AdapterFree(path); \ BundleInfoUtils::FreeBundleInfo(bundleInfo); \ FREE_SIGNATUREINFO(signatureInfo); \ - UI_Free(permissions.permissionTrans); \ + UI_Free((permissions).permissionTrans); \ return errcode; \ } \ } while (0) #define CHECK_PRO_ROLLBACK(errcode, permissions, bundleInfo, signatureInfo, randStr) \ do { \ - if (errcode != ERR_OK && bundleInfo != nullptr) { \ + if ((errcode) != ERR_OK && (bundleInfo) != nullptr) { \ FREE_SIGNATUREINFO(signatureInfo); \ UI_Free(permissions.permissionTrans); \ GtManagerService::GetInstance().RemoveBundleInfo(bundleInfo->bundleName); \ - BundleUtil::DeleteJsonFile(bundleInfo->bundleName, randStr); \ + BundleUtil::DeleteJsonFile((bundleInfo)->bundleName, randStr); \ CLEAR_INSTALL_ENV(bundleInfo); \ return errcode; \ } \ diff --git a/services/bundlemgr_lite/include/gt_bundle_parser.h b/services/bundlemgr_lite/include/gt_bundle_parser.h index be0443fdbbd01d6d64d68a17bafcf115df1e9669..c7b37d2debb44a38b1bd5f26ef7fc345ea311409 100644 --- a/services/bundlemgr_lite/include/gt_bundle_parser.h +++ b/services/bundlemgr_lite/include/gt_bundle_parser.h @@ -56,21 +56,21 @@ private: #define CHECK_NULL(object, errorCode) \ do { \ - if (object == nullptr) { \ + if ((object) == nullptr) { \ return errorCode; \ } \ } while (0) #define CHECK_LENGTH(length, maxLength, errorCode) \ do { \ - if (length > maxLength) { \ + if ((length) > maxLength) { \ return errorCode; \ } \ } while (0) #define CHECK_IS_TRUE(result, errorCode) \ do { \ - if (!result) { \ + if (!(result)) { \ return errorCode; \ } \ } while (0) @@ -78,20 +78,20 @@ private: #define FREE_BUNDLE_PROFILE(bundleProfile) \ do { \ for (int32_t i = 0; i < METADATA_SIZE; i++) { \ - AdapterFree(bundleProfile.moduleInfo.metaData[i]); \ + AdapterFree((bundleProfile).moduleInfo.metaData[i]); \ } \ } while (0) #define FREE_BUNDLE_RES(bundleRes) \ do { \ - if (bundleRes.abilityRes != nullptr) { \ - AdapterFree(bundleRes.abilityRes); \ + if ((bundleRes).abilityRes != nullptr) { \ + AdapterFree((bundleRes).abilityRes); \ } \ } while (0) #define CHECK_PARSE_RESULT(errorCode, object, bundleProfile, bundleRes) \ do { \ - if (errorCode != ERR_OK) { \ + if ((errorCode) != ERR_OK) { \ FREE_BUNDLE_PROFILE(bundleProfile); \ FREE_BUNDLE_RES(bundleRes); \ cJSON_Delete(object); \ diff --git a/services/bundlemgr_lite/src/bundle_ms_feature.cpp b/services/bundlemgr_lite/src/bundle_ms_feature.cpp index 6edbe6cfcd9db52ea606524292a518bc1e4cc8b1..e94e85a18cf6891f7c9000369c3e5bda3b841897 100755 --- a/services/bundlemgr_lite/src/bundle_ms_feature.cpp +++ b/services/bundlemgr_lite/src/bundle_ms_feature.cpp @@ -117,7 +117,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 745816180b3f29306e264befbd96437a8059a4a2..e8b3246f96440dc34964a2e1065a370faa5bf24a 100755 --- a/services/bundlemgr_lite/src/bundle_util.cpp +++ b/services/bundlemgr_lite/src/bundle_util.cpp @@ -32,11 +32,11 @@ #include "dirent.h" #include "fcntl.h" #include "los_tick.h" -#include "stdio.h" +#include #include "sys/stat.h" #include "unistd.h" #endif -#include +#include #include "utils.h" namespace OHOS { diff --git a/services/bundlemgr_lite/src/gt_bundle_installer.cpp b/services/bundlemgr_lite/src/gt_bundle_installer.cpp index 69eeefcd9b7d94ebcd3e7dbe29b2ff93c20b3a2d..9a3bb511a5c67c62e01e3741d5caedbecfc1b05a 100755 --- a/services/bundlemgr_lite/src/gt_bundle_installer.cpp +++ b/services/bundlemgr_lite/src/gt_bundle_installer.cpp @@ -31,7 +31,7 @@ extern "C" { #include "gt_bundle_extractor.h" #include "gt_bundle_manager_service.h" #include "gt_bundle_parser.h" -#include "stdio.h" +#include #include "sys/stat.h" #include "unistd.h" #include "utils.h" diff --git a/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp b/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp index 4d9e53477c7b7138fb5d0ea3696519ccf682a059..8936379390083f2050b88e644946f22a791cfa7c 100755 --- a/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp +++ b/services/bundlemgr_lite/src/gt_bundle_manager_service.cpp @@ -30,7 +30,7 @@ #include "gt_extractor_util.h" #include "jerryscript_adapter.h" #include "los_tick.h" -#include "stdio.h" +#include #include "sys/stat.h" #include "unistd.h" #include "utils.h" diff --git a/services/bundlemgr_lite/src/gt_extractor_util.cpp b/services/bundlemgr_lite/src/gt_extractor_util.cpp index 02ab2c566996892d3cb321ef7ba8da28adf0f424..3b26df4ebfa4ed8784d75a0f4304dd997aa7c8de 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 "dirent.h" #include "fcntl.h" -#include "stdio.h" +#include #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 ef9452992822b319db0908554ce89a41ba50af98..0f5f5e9531e777f2ee00d8263c93bdea8fd721b3 100755 --- a/services/bundlemgr_lite/src/zip_file.cpp +++ b/services/bundlemgr_lite/src/zip_file.cpp @@ -28,10 +28,10 @@ namespace OHOS { namespace { #define ZIPPOS_ADD_AND_CHECK_OVERFLOW(first, second, sum) \ { \ - if ((second > 0) && (first > (std::numeric_limits::max() - second))) { \ + if (((second) > 0) && ((first) > (std::numeric_limits::max() - (second)))) { \ return false; \ } \ - sum = first + second; \ + (sum) = (first) + (second); \ } constexpr uint32_t MAX_FILE_NAME = 256; diff --git a/utils/bundle_lite/adapter.h b/utils/bundle_lite/adapter.h index 0f53edb9dcb0aa64185fbf127eb1bf6c608cd282..2ecd0386df3864dffd4529aa25480b25b7259668 100755 --- a/utils/bundle_lite/adapter.h +++ b/utils/bundle_lite/adapter.h @@ -32,8 +32,8 @@ #define AdapterMalloc(a) malloc(a) #define AdapterFree(a) \ do { \ - if (a != nullptr) { \ - (void) free((void *)a); \ + if ((a) != nullptr) { \ + (void) free((void *)(a)); \ a = nullptr; \ } \ } while (0)