fix alerts

Signed-off-by: xsz233 <xushizhe@huawei.com>
This commit is contained in:
xsz233
2022-10-25 21:30:24 +08:00
parent e65f13ccd2
commit ce6166eb46
3 changed files with 19 additions and 19 deletions
@@ -123,7 +123,7 @@ bool ManagerService::GetAmsInterface(AmsInnerInterface **amsInterface)
return false;
}
int result = iUnknown->QueryInterface(iUnknown, 0, (void **) amsInterface);
int result = iUnknown->QueryInterface(iUnknown, 0, reinterpret_cast<void **>(amsInterface));
if (result != 0) {
HILOG_ERROR(HILOG_MODULE_APP, "BundleMS Query ams Interface failed: %{public}d\n", result);
return false;
@@ -647,8 +647,8 @@ uint32_t ManagerService::GetBundleSize(const char *bundleName)
std::string ManagerService::GetCodeDirPath() const
{
std::string codeDirPath;
if (installer_ == nullptr) {
std::string codeDirPath;
return codeDirPath;
}
return installer_->GetCodeDirPath();
@@ -656,8 +656,8 @@ std::string ManagerService::GetCodeDirPath() const
std::string ManagerService::GetDataDirPath() const
{
std::string dataDirPath;
if (installer_ == nullptr) {
std::string dataDirPath;
return dataDirPath;
}
return installer_->GetDataDirPath();
@@ -320,17 +320,17 @@ void GtManagerService::InstallAllSystemBundle(InstallerCallback installerCallbac
if (currentNode == nullptr) {
return;
}
if ((strcmp(((AppInfoList *)currentNode)->filePath, ".") == 0) ||
(strcmp(((AppInfoList *)currentNode)->filePath, "..") == 0)) {
if ((strcmp((reinterpret_cast<AppInfoList *>(currentNode))->filePath, ".") == 0) ||
(strcmp((reinterpret_cast<AppInfoList *>(currentNode))->filePath, "..") == 0)) {
continue;
}
if (!BundleUtil::IsFile(((AppInfoList *)currentNode)->filePath) ||
!BundleUtil::EndWith(((AppInfoList *)currentNode)->filePath, INSTALL_FILE_SUFFIX)) {
if (!BundleUtil::IsFile((reinterpret_cast<AppInfoList *>(currentNode))->filePath) ||
!BundleUtil::EndWith((reinterpret_cast<AppInfoList *>(currentNode))->filePath, INSTALL_FILE_SUFFIX)) {
GtManagerService::APP_FreeAllAppInfo(list);
return;
}
(void) Install(((AppInfoList *)currentNode)->filePath, nullptr, installerCallback);
(void) Install((reinterpret_cast<AppInfoList *>(currentNode))->filePath, nullptr, installerCallback);
}
GtManagerService::APP_FreeAllAppInfo(list);
}
@@ -441,21 +441,21 @@ void GtManagerService::ScanSystemApp(const cJSON *uninstallRecord, List<ToBeInst
if (currentNode == nullptr) {
return;
}
if ((strcmp(((AppInfoList *)currentNode)->filePath, ".") == 0) ||
(strcmp(((AppInfoList *)currentNode)->filePath, "..") == 0)) {
if ((strcmp((reinterpret_cast<AppInfoList *>(currentNode))->filePath, ".") == 0) ||
(strcmp((reinterpret_cast<AppInfoList *>(currentNode))->filePath, "..") == 0)) {
continue;
}
if (BundleUtil::StartWith(((AppInfoList *)currentNode)->filePath, SYSTEM_BUNDLE_PATH)) {
if (BundleUtil::StartWith((reinterpret_cast<AppInfoList *>(currentNode))->filePath, SYSTEM_BUNDLE_PATH)) {
scanFlag = SYSTEM_APP_FLAG;
} else if (BundleUtil::StartWith(((AppInfoList *)currentNode)->filePath, THIRD_SYSTEM_BUNDLE_PATH)) {
} else if (BundleUtil::StartWith((reinterpret_cast<AppInfoList *>(currentNode))->filePath, THIRD_SYSTEM_BUNDLE_PATH)) {
scanFlag = THIRD_SYSTEM_APP_FLAG;
} else {
continue; // skip third app
}
// scan system app
bool res = CheckSystemBundleIsValid(((AppInfoList *)currentNode)->filePath, &bundleName, versionCode);
bool res = CheckSystemBundleIsValid((reinterpret_cast<AppInfoList *>(currentNode))->filePath, &bundleName, versionCode);
if (!res) {
APP_ERRCODE_EXTRA(EXCE_ACE_APP_SCAN, EXCE_ACE_APP_SCAN_INVALID_SYSTEM_APP);
AdapterFree(bundleName);
@@ -469,7 +469,7 @@ void GtManagerService::ScanSystemApp(const cJSON *uninstallRecord, List<ToBeInst
continue;
}
ReloadEntireBundleInfo(((AppInfoList *)currentNode)->filePath, bundleName,
ReloadEntireBundleInfo((reinterpret_cast<AppInfoList *>(currentNode))->filePath, bundleName,
systemPathList, versionCode, scanFlag);
AdapterFree(bundleName);
}
@@ -979,7 +979,7 @@ int32_t GtManagerService::ReportUninstallCallback(uint8_t errCode, uint8_t insta
AppInfoList *GtManagerService::APP_InitAllAppInfo()
{
AppInfoList *list = (AppInfoList *)AdapterMalloc(sizeof(AppInfoList));
AppInfoList *list = reinterpret_cast<AppInfoList *>(AdapterMalloc(sizeof(AppInfoList)));
if (list == nullptr) {
return nullptr;
}
@@ -1054,7 +1054,7 @@ void GtManagerService::APP_InsertAppInfo(char *filePath, AppInfoList *list)
return;
}
AppInfoList *app = (AppInfoList *)AdapterMalloc(sizeof(AppInfoList));
AppInfoList *app = reinterpret_cast<AppInfoList *>(AdapterMalloc(sizeof(AppInfoList)));
if (app == nullptr) {
return;
}
@@ -1110,7 +1110,7 @@ void SetCurrentBundle(const char *name)
}
int len = strlen(name);
g_currentBundle = (char *)AdapterMalloc(len + 1);
g_currentBundle = static_cast<char *>(AdapterMalloc(len + 1));
if (g_currentBundle == nullptr || strncpy_s(g_currentBundle, len + 1, name, len) < 0) {
AdapterFree(g_currentBundle);
}
@@ -1126,7 +1126,7 @@ const char *GetCurrentBundle()
}
int len = strlen(g_currentBundle);
char *bundleName = (char *)AdapterMalloc(len + 1);
char *bundleName = static_cast<char *>(AdapterMalloc(len + 1));
if (bundleName == nullptr || strncpy_s(bundleName, len + 1, g_currentBundle, len) < 0) {
AdapterFree(bundleName);
MutexRelease(&g_currentBundleMutex);
+1 -1
View File
@@ -509,7 +509,7 @@ bool ZipFile::UnzipWithInflated(const ZipEntry &zipEntry, const uint16_t extraSi
size_t inflateLen = UNZIP_BUF_OUT_LEN - zstream.avail_out;
if (inflateLen > 0) {
dest.write((const char*)bufOut, inflateLen);
dest.write(reinterpret_cast<const char*>(bufOut), inflateLen);
zstream.next_out = bufOut;
zstream.avail_out = UNZIP_BUF_OUT_LEN;
errorTimes = 0;