mirror of
https://github.com/openharmony/bundlemanager_bundle_framework_lite.git
synced 2026-07-19 12:13:04 -04:00
IssueNo:#I4TZOJ
Description:solve codex Sig:appexecfwk Feature or Bugfix:Bugfix Binary Source:No Signed-off-by: wangdengjia <wangdengjia@huawei.com> Change-Id: I8a698f86d136e909d2467790c14c21daeb1405d6 Signed-off-by: wangdengjia <wangdengjia@huawei.com>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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}.
|
||||
*/
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
|
||||
#include "bundle_daemon_handler.h"
|
||||
|
||||
#include <climits>
|
||||
#include <cstring>
|
||||
#include <dirent.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "bundle_daemon_log.h"
|
||||
#include "bundle_file_utils.h"
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
|
||||
#include "bundle_file_utils.h"
|
||||
|
||||
#include <climits>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#ifndef OHOS_BUNDLE_EXTRACTOR_H
|
||||
#define OHOS_BUNDLE_EXTRACTOR_H
|
||||
|
||||
#include "stdint.h"
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#define OHOS_GT_BUNDLE_EXTRACTOR_H
|
||||
|
||||
#include "bundle_common.h"
|
||||
#include "stdint.h"
|
||||
|
||||
namespace OHOS {
|
||||
class GtBundleExtractor {
|
||||
|
||||
@@ -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) \
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 <stdlib.h>
|
||||
#include <cstdlib>
|
||||
#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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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<char *>(ASSETS), relativeIconPath, const_cast<char *>(ICON_NAME)
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
|
||||
#include "gt_extractor_util.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <climits>
|
||||
#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"
|
||||
|
||||
@@ -26,13 +26,13 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace {
|
||||
#define ZIPPOS_ADD_AND_CHECK_OVERFLOW(first, second, sum) \
|
||||
{ \
|
||||
if ((second > 0) && (first > (std::numeric_limits<ZipPos>::max() - second))) { \
|
||||
return false; \
|
||||
} \
|
||||
sum = first + second; \
|
||||
}
|
||||
#define ZIPPOS_ADD_AND_CHECK_OVERFLOW(first, second, sum) \
|
||||
do { \
|
||||
if ((second > 0) && (first > (std::numeric_limits<ZipPos>::max() - second))) { \
|
||||
return false; \
|
||||
} \
|
||||
sum = first + second; \
|
||||
} while (0)
|
||||
|
||||
constexpr uint32_t MAX_FILE_NAME = 256;
|
||||
constexpr uint32_t UNZIP_BUFFER_SIZE = 1024;
|
||||
|
||||
Reference in New Issue
Block a user