修改编译告警

Signed-off-by: shihaojie6128 <shihaojie10@huawei.com>
This commit is contained in:
shihaojie6128 2024-04-27 14:41:04 +08:00
parent 218b419682
commit ca6dd9ebdf
8 changed files with 23 additions and 18 deletions

View File

@ -18,8 +18,8 @@
static napi_module _module = {
.nm_filename = "continuation/libcontinuationmanager_napi.so/continuationmanager.js",
.nm_modname = "continuation.continuationManager",
.nm_register_func = OHOS::DistributedSchedule::JsContinuationManagerInit,
.nm_modname = "continuation.continuationManager",
};
__attribute__((constructor)) static void NAPI_application_continuationmanager_AutoRegister()

View File

@ -69,6 +69,7 @@ private:
int32_t StartAbilityByCallFromRemoteInner(MessageParcel& data, MessageParcel& reply);
int32_t ReleaseAbilityFromRemoteInner(MessageParcel& data, MessageParcel& reply);
int32_t StartRemoteFreeInstallInner(MessageParcel& data, MessageParcel& reply);
int32_t CreateJsonObject(std::string& extraInfo, CallerInfo& callerInfo);
int32_t StartFreeInstallFromRemoteInner(MessageParcel& data, MessageParcel& reply);
int32_t ReadDataForFreeInstall(MessageParcel& data,
CallerInfo &callerInfo, AccountInfo &accountInfo, int64_t &taskId);

View File

@ -605,7 +605,7 @@ int32_t DSchedContinue::ExecuteContinueSend(std::shared_ptr<ContinueAbilityData>
}
callerInfo.extraInfoJson[DMS_VERSION_ID] = DMS_VERSION;
AccountInfo accountInfo;
int32_t ret = DistributedSchedPermission::GetInstance().GetAccountInfo(continueInfo_.sourceDeviceId_, callerInfo,
int32_t ret = DistributedSchedPermission::GetInstance().GetAccountInfo(continueInfo_.sinkDeviceId_, callerInfo,
accountInfo);
if (ret != ERR_OK) {
HILOGE("GetAccountInfo failed");

View File

@ -273,7 +273,6 @@ int32_t DSchedContinueDataCmd::MarshalCallerInfo(std::string &jsonStr)
return INVALID_PARAMETERS_ERR;
}
cJSON_AddItemToArray(bundleNames, bundleName);
cJSON_Delete(bundleName);
}
cJSON_AddItemToObject(callerInfoJson, "BundleNames", bundleNames);
@ -314,7 +313,6 @@ int32_t DSchedContinueDataCmd::MarshalAccountInfo(std::string &jsonStr)
return INVALID_PARAMETERS_ERR;
}
cJSON_AddItemToArray(groupIdList, groupId);
cJSON_Delete(groupId);
}
cJSON_AddItemToObject(accountInfoJson, "GroupIdList", groupIdList);

View File

@ -1381,7 +1381,7 @@ bool DistributedWant::ParseContent(const std::string& content, std::string& prop
if (length < dPos + 1) {
return false;
}
length -= dPos - 1;
length = length - dPos - 1;
subString = content.substr(dPos + 1, length);
value = Decode(subString);
return true;

View File

@ -149,7 +149,7 @@ sptr<IDistributedWantParams> DistributedWantParamWrapper::Parse(const std::strin
if (strKey == "") {
strnum++;
size_t pos = str.find('"', strnum);
if (pos != std::string::npos) {
if (pos != std::string::npos && pos > strnum) {
strKey = str.substr(strnum, pos - strnum);
}
strnum = pos;

View File

@ -1270,6 +1270,21 @@ int32_t DistributedSchedStub::ReadDataForFreeInstall(MessageParcel& data, Caller
return ERR_NONE;
}
int32_t DistributedSchedStub::CreateJsonObject(std::string& extraInfo, CallerInfo& callerInfo)
{
nlohmann::json extraInfoJson = nlohmann::json::parse(extraInfo, nullptr, false);
int32_t requestCode = DEFAULT_REQUEST_CODE;
if (!extraInfoJson.is_discarded()) {
SaveExtraInfo(extraInfoJson, callerInfo);
if (extraInfoJson.find(EXTRO_INFO_JSON_KEY_REQUEST_CODE) != extraInfoJson.end() &&
extraInfoJson[EXTRO_INFO_JSON_KEY_REQUEST_CODE].is_number_integer()) {
requestCode = extraInfoJson[EXTRO_INFO_JSON_KEY_REQUEST_CODE];
HILOGD("parse extra info, requestCode = %d", requestCode);
}
}
return requestCode;
}
int32_t DistributedSchedStub::StartFreeInstallFromRemoteInner(MessageParcel& data, MessageParcel& reply)
{
if (!CheckCallingUid()) {
@ -1298,18 +1313,9 @@ int32_t DistributedSchedStub::StartFreeInstallFromRemoteInner(MessageParcel& dat
if (extraInfo.empty()) {
HILOGD("extra info is empty!");
}
nlohmann::json extraInfoJson = nlohmann::json::parse(extraInfo, nullptr, false);
int32_t requestCode = DEFAULT_REQUEST_CODE;
if (!extraInfoJson.is_discarded()) {
SaveExtraInfo(extraInfoJson, callerInfo);
if (extraInfoJson.find(EXTRO_INFO_JSON_KEY_REQUEST_CODE) != extraInfoJson.end() &&
extraInfoJson[EXTRO_INFO_JSON_KEY_REQUEST_CODE].is_number_integer()) {
requestCode = extraInfoJson[EXTRO_INFO_JSON_KEY_REQUEST_CODE];
HILOGD("parse extra info, requestCode = %d", requestCode);
}
}
int32_t requestCode = CreateJsonObject(extraInfo, callerInfo);
FreeInstallInfo info = {
.want = *want, .callerInfo = callerInfo, .accountInfo = accountInfo, .requestCode = requestCode};
.want = *want, .callerInfo = callerInfo, .requestCode = requestCode, .accountInfo = accountInfo};
info.want.RemoveParam(PARAM_FREEINSTALL_APPID);
info.want.SetParam(PARAM_FREEINSTALL_APPID, callerInfo.callerAppId);
info.want.RemoveParam(PARAM_FREEINSTALL_BUNDLENAMES);

View File

@ -143,8 +143,8 @@ Status DistributedDataStorage::GetKvStore()
.encrypt = false,
.autoSync = true,
.securityLevel = DistributedKv::SecurityLevel::S2,
.kvStoreType = KvStoreType::SINGLE_VERSION,
.area = 1,
.kvStoreType = KvStoreType::SINGLE_VERSION,
.baseDir = KVDB_PATH
};
Status status = dataManager_.GetSingleKvStore(options, appId_, storeId_, kvStorePtr_);