diff --git a/interfaces/kits/bundle_lite/bundle_manager.h b/interfaces/kits/bundle_lite/bundle_manager.h index 3548415ec75c54ab83d1d64c120dd4d460a9e373..39086ae6b95041242cec444df43dd225ba445415 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_installer.h b/services/bundlemgr_lite/include/bundle_installer.h index b9945ff9326ed63b1eecf90a2611ed3a96794f02..223ca536273c1ff5d2c63f293339f156504bb087 100755 --- a/services/bundlemgr_lite/include/bundle_installer.h +++ b/services/bundlemgr_lite/include/bundle_installer.h @@ -72,7 +72,7 @@ private: do { \ if (errcode != ERR_OK) { \ BundleInfoUtils::FreeBundleInfo(bundleInfo); \ - AdapterFree(permissions.permissionTrans); \ + AdapterFree((permissions).permissionTrans); \ AdapterFree(abilityRes); \ return errcode; \ } \ @@ -80,7 +80,7 @@ private: #define CLEAR_INSTALL_ENV(bundleInfo) \ do { \ - if (bundleInfo != nullptr) { \ + if ((bundleInfo) != nullptr) { \ BundleDaemonClient::GetInstance().RemoveInstallDirectory( \ bundleInfo->codePath, bundleInfo->dataPath, false); \ BundleInfoUtils::FreeBundleInfo(bundleInfo); \ @@ -89,8 +89,8 @@ private: #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(abilityRes); \ @@ -100,7 +100,7 @@ private: #define CHECK_PRO_ROLLBACK(errcode, permissions, bundleInfo, abilityRes, randStr) \ do { \ - if (errcode != ERR_OK && bundleInfo != nullptr) { \ + if ((errcode) != ERR_OK && (bundleInfo) != nullptr) { \ AdapterFree(permissions.permissionTrans); \ AdapterFree(abilityRes); \ ManagerService::GetInstance().RemoveBundleInfo(bundleInfo->bundleName); \ diff --git a/services/bundlemgr_lite/include/bundle_parser.h b/services/bundlemgr_lite/include/bundle_parser.h index 51dfa6637c06dc8033068604ec9d55af89a2251a..cac281c377d04bfc5ee648364939c50cb2b28279 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; \ diff --git a/services/bundlemgr_lite/include/bundlems_log.h b/services/bundlemgr_lite/include/bundlems_log.h index d744ddaaf42d818652205cb9a461c4d8bd536ba3..c5601d4614074ea9c2198a3590987602bf19f936 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 c373b3516c0fca1e278a1586472484eb17916294..01700d57c97dcf4f71d5dd6b7975bf849ef84922 100755 --- a/services/bundlemgr_lite/include/gt_bundle_installer.h +++ b/services/bundlemgr_lite/include/gt_bundle_installer.h @@ -69,7 +69,7 @@ private: #define FREE_PRO_RESOURCE(fp, permissions, bundleInfo) \ do { \ - if (fp >= 0) { \ + if ((fp) >= 0) { \ close(fp); \ } \ BundleInfoUtils::FreeBundleInfo(bundleInfo); \ @@ -85,7 +85,7 @@ private: #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; \ @@ -94,7 +94,7 @@ private: #define CLEAR_INSTALL_ENV(bundleInfo) \ do { \ - if (bundleInfo != nullptr) { \ + if ((bundleInfo) != nullptr) { \ BundleUtil::RemoveDir(bundleInfo->codePath); \ BundleUtil::RemoveDir(bundleInfo->dataPath); \ BundleInfoUtils::FreeBundleInfo(bundleInfo); \ @@ -103,7 +103,7 @@ private: #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); \ @@ -115,7 +115,7 @@ private: #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); \ diff --git a/services/bundlemgr_lite/include/gt_bundle_parser.h b/services/bundlemgr_lite/include/gt_bundle_parser.h index be0443fdbbd01d6d64d68a17bafcf115df1e9669..0989b8dcac40d184d840b0c8b2b1454686e04f71 100644 --- a/services/bundlemgr_lite/include/gt_bundle_parser.h +++ b/services/bundlemgr_lite/include/gt_bundle_parser.h @@ -56,14 +56,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) @@ -91,7 +91,7 @@ private: #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/zip_file.cpp b/services/bundlemgr_lite/src/zip_file.cpp index 4e416783072470c666db43d12ff177728ead4c26..c068a94644255a889eb0b026029b099007fa012b 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) \ do { \ - 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); \ } while (0) constexpr uint32_t MAX_FILE_NAME = 256; diff --git a/utils/bundle_lite/adapter.h b/utils/bundle_lite/adapter.h index 913770924314bf2d2c1f05644d1c979b9a65020f..7cdc82b8583fd9f9c5a3acbacdf7a7dd71a28599 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)