mirror of
https://github.com/openharmony/appexecfwk_appexecfwk_lite.git
synced 2026-07-01 21:04:03 -04:00
@@ -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.
|
||||
|
||||
@@ -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; \
|
||||
} \
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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; \
|
||||
} \
|
||||
|
||||
@@ -69,23 +69,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).appId); \
|
||||
AdapterFree(signatureInfo.bundleName); \
|
||||
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; \
|
||||
@@ -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,21 +103,21 @@ 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); \
|
||||
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); \
|
||||
UI_Free((permissions).permissionTrans); \
|
||||
GtManagerService::GetInstance().RemoveBundleInfo(bundleInfo->bundleName); \
|
||||
BundleUtil::DeleteJsonFile(bundleInfo->bundleName, randStr); \
|
||||
CLEAR_INSTALL_ENV(bundleInfo); \
|
||||
|
||||
@@ -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); \
|
||||
|
||||
@@ -28,10 +28,10 @@ namespace OHOS {
|
||||
namespace {
|
||||
#define ZIPPOS_ADD_AND_CHECK_OVERFLOW(first, second, sum) \
|
||||
do { \
|
||||
if ((second > 0) && (first > (std::numeric_limits<ZipPos>::max() - second))) { \
|
||||
if (((second) > 0) && ((first) > (std::numeric_limits<ZipPos>::max() - (second)))) { \
|
||||
return false; \
|
||||
} \
|
||||
sum = first + second; \
|
||||
(sum) = (first) + (second); \
|
||||
} while (0)
|
||||
|
||||
constexpr uint32_t MAX_FILE_NAME = 256;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user