faf告警

Signed-off-by: futurezhou <jiashuai10@huawei.com>
This commit is contained in:
futurezhou 2023-05-24 15:42:54 +08:00
parent c4df727063
commit a98f393bf0
9 changed files with 29 additions and 25 deletions

View File

@ -26,14 +26,14 @@ class FileAccessExtensionAbility {
createFile(parentUri, displayName) {
return {
uri: "",
uri: '',
code: ERR_ERROR,
};
}
mkdir(parentUri, displayName) {
return {
uri: "",
uri: '',
code: ERR_ERROR,
};
}

View File

@ -192,7 +192,7 @@ napi_value NAPI_GetFileAccessAbilityInfo(napi_env env, napi_callback_info info)
}
auto result = std::make_shared<std::vector<AAFwk::Want>>();
if (result == nullptr) {
if (!result) {
NError(E_GETRESULT).ThrowErr(env);
return nullptr;
}
@ -332,7 +332,7 @@ napi_value NAPI_OpenFile(napi_env env, napi_callback_info info)
}
auto result = std::make_shared<int>();
if (result == nullptr) {
if (!result) {
NError(E_GETRESULT).ThrowErr(env);
return nullptr;
}
@ -386,7 +386,7 @@ napi_value NAPI_CreateFile(napi_env env, napi_callback_info info)
}
auto result = std::make_shared<string>();
if (result == nullptr) {
if (!result) {
NError(E_GETRESULT).ThrowErr(env);
return nullptr;
}
@ -443,7 +443,7 @@ napi_value NAPI_Mkdir(napi_env env, napi_callback_info info)
}
auto result = std::make_shared<string>();
if (result == nullptr) {
if (!result) {
NError(E_GETRESULT).ThrowErr(env);
return nullptr;
}
@ -500,7 +500,7 @@ napi_value NAPI_Delete(napi_env env, napi_callback_info info)
}
auto result = std::make_shared<int>();
if (result == nullptr) {
if (!result) {
NError(E_GETRESULT).ThrowErr(env);
return nullptr;
}
@ -554,7 +554,7 @@ napi_value NAPI_Move(napi_env env, napi_callback_info info)
}
auto result = std::make_shared<string>();
if (result == nullptr) {
if (!result) {
NError(E_GETRESULT).ThrowErr(env);
return nullptr;
}
@ -738,7 +738,7 @@ napi_value NAPI_Copy(napi_env env, napi_callback_info info)
}
auto result = std::make_shared<std::vector<CopyResult>>();
if (result == nullptr) {
if (!result) {
NError(E_GETRESULT).ThrowErr(env);
return nullptr;
}
@ -809,7 +809,7 @@ napi_value NAPI_Rename(napi_env env, napi_callback_info info)
}
auto result = std::make_shared<string>();
if (result == nullptr) {
if (!result) {
NError(E_GETRESULT).ThrowErr(env);
return nullptr;
}
@ -882,7 +882,7 @@ napi_value NAPI_GetRoots(napi_env env, napi_callback_info info)
}
auto result = std::make_shared<std::vector<RootInfo>>();
if (result == nullptr) {
if (!result) {
NError(E_GETRESULT).ThrowErr(env);
return nullptr;
}
@ -1013,7 +1013,7 @@ napi_value NAPI_GetFileInfoFromUri(napi_env env, napi_callback_info info)
}
auto result = std::make_shared<FileInfo>();
if (result == nullptr) {
if (!result) {
NError(E_GETRESULT).ThrowErr(env);
return nullptr;
}
@ -1075,7 +1075,7 @@ napi_value NAPI_GetFileInfoFromRelativePath(napi_env env, napi_callback_info inf
}
auto result = std::make_shared<FileInfo>();
if (result == nullptr) {
if (!result) {
NError(E_GETRESULT).ThrowErr(env);
return nullptr;
}

View File

@ -50,7 +50,8 @@ public:
const FileFilter &filter, std::vector<FileInfo> &fileInfoVec) override;
virtual int ScanFile(const FileInfo &fileInfo, const int64_t offset, const int64_t maxCount,
const FileFilter &filter, std::vector<FileInfo> &fileInfoVec) override;
virtual int GetThumbnail(const Uri &uri, const ThumbnailSize &thumbnailSize, std::shared_ptr<PixelMap> &pixelMap) override;
virtual int GetThumbnail(const Uri &uri, const ThumbnailSize &thumbnailSize,
std::shared_ptr<PixelMap> &pixelMap) override;
virtual int Query(const Uri &uri, std::vector<std::string> &columns, std::vector<std::string> &results) override;
virtual int GetFileInfoFromUri(const Uri &selectFile, FileInfo &fileInfo) override;
virtual int GetFileInfoFromRelativePath(const std::string &selectFile, FileInfo &fileInfo) override;

View File

@ -66,7 +66,8 @@ public:
const FileFilter &filter, std::vector<FileInfo> &fileInfoVec) = 0;
virtual int ScanFile(const FileInfo &fileInfo, const int64_t offset, const int64_t maxCount,
const FileFilter &filter, std::vector<FileInfo> &fileInfoVec) = 0;
virtual int GetThumbnail(const Uri &uri, const ThumbnailSize &thumbnailSize, std::shared_ptr<PixelMap> &pixelMap) = 0;
virtual int GetThumbnail(const Uri &uri, const ThumbnailSize &thumbnailSize,
std::shared_ptr<PixelMap> &pixelMap) = 0;
virtual int Query(const Uri &uri, std::vector<std::string> &columns, std::vector<std::string> &results) = 0;
virtual int GetFileInfoFromUri(const Uri &selectFile, FileInfo &fileInfo) = 0;
virtual int GetFileInfoFromRelativePath(const std::string &selectFile, FileInfo &fileInfo) = 0;

View File

@ -750,7 +750,8 @@ static int WriteThumbnailArgs(MessageParcel &data, const Uri &uri, const Thumbna
return ERR_OK;
}
int FileAccessExtProxy::GetThumbnail(const Uri &uri, const ThumbnailSize &thumbnailSize, std::shared_ptr<PixelMap> &pixelMap)
int FileAccessExtProxy::GetThumbnail(const Uri &uri, const ThumbnailSize &thumbnailSize,
std::shared_ptr<PixelMap> &pixelMap)
{
StartTrace(HITRACE_TAG_FILEMANAGEMENT, "GetThumbnail");
MessageParcel data;

View File

@ -184,7 +184,8 @@ int FileAccessExtStubImpl::GetRoots(std::vector<RootInfo> &rootInfoVec)
return ret;
}
int FileAccessExtStubImpl::GetThumbnail(const Uri &uri, const ThumbnailSize &thumbnailSize, std::shared_ptr<PixelMap> &pixelMap)
int FileAccessExtStubImpl::GetThumbnail(const Uri &uri, const ThumbnailSize &thumbnailSize,
std::shared_ptr<PixelMap> &pixelMap)
{
StartTrace(HITRACE_TAG_FILEMANAGEMENT, "GetThumbnail");
if (extension_ == nullptr) {

View File

@ -212,7 +212,7 @@ std::pair<std::shared_ptr<FileAccessHelper>, int> FileAccessHelper::Creator(
}
std::shared_ptr<ConnectInfo> connectInfo = std::make_shared<ConnectInfo>();
if (connectInfo == nullptr) {
if (!connectInfo) {
HILOG_ERROR("Creator, connectInfo == nullptr");
FinishTrace(HITRACE_TAG_FILEMANAGEMENT);
return {nullptr, E_GETRESULT};
@ -359,7 +359,7 @@ std::shared_ptr<FileAccessHelper> FileAccessHelper::Creator(const sptr<IRemoteOb
}
std::shared_ptr<ConnectInfo> connectInfo = std::make_shared<ConnectInfo>();
if (connectInfo == nullptr) {
if (!connectInfo) {
HILOG_ERROR("Creator, connectInfo == nullptr");
FinishTrace(HITRACE_TAG_FILEMANAGEMENT);
return nullptr;

View File

@ -358,7 +358,7 @@ int JsFileAccessExtAbility::CreateFile(const Uri &parent, const std::string &dis
{
StartTrace(HITRACE_TAG_FILEMANAGEMENT, "CreateFile");
auto value = std::make_shared<Value<std::string>>();
if (value == nullptr) {
if (!value) {
HILOG_ERROR("CreateFile value is nullptr.");
FinishTrace(HITRACE_TAG_FILEMANAGEMENT);
return E_GETRESULT;
@ -419,7 +419,7 @@ int JsFileAccessExtAbility::Mkdir(const Uri &parent, const std::string &displayN
{
StartTrace(HITRACE_TAG_FILEMANAGEMENT, "Mkdir");
auto value = std::make_shared<Value<std::string>>();
if (value == nullptr) {
if (!value) {
HILOG_ERROR("Mkdir value is nullptr.");
FinishTrace(HITRACE_TAG_FILEMANAGEMENT);
return E_GETRESULT;
@ -480,7 +480,7 @@ int JsFileAccessExtAbility::Delete(const Uri &sourceFile)
{
StartTrace(HITRACE_TAG_FILEMANAGEMENT, "Delete");
auto ret = std::make_shared<int>();
if (ret == nullptr) {
if (!ret) {
HILOG_ERROR("Delete value is nullptr.");
FinishTrace(HITRACE_TAG_FILEMANAGEMENT);
return E_GETRESULT;

View File

@ -357,7 +357,7 @@ bool RenameFuzzTest(const uint8_t* data, size_t size)
bool ListFileFuzzTest(const uint8_t* data, size_t size)
{
if ((data == nullptr) || (size <= 0)) {
if ((data == nullptr) || (size == 0)) {
HILOG_ERROR("parameter data is nullptr or parameter size <= 0.");
return false;
}
@ -383,7 +383,7 @@ bool ListFileFuzzTest(const uint8_t* data, size_t size)
bool ScanFileFuzzTest(const uint8_t* data, size_t size)
{
if ((data == nullptr) || (size <= 0)) {
if ((data == nullptr) || (size == 0)) {
HILOG_ERROR("parameter data is nullptr or parameter size <= 0.");
return false;
}
@ -409,7 +409,7 @@ bool ScanFileFuzzTest(const uint8_t* data, size_t size)
bool GetFileInfoFromUriFuzzTest(const uint8_t* data, size_t size)
{
if ((data == nullptr) || (size <= 0)) {
if ((data == nullptr) || (size == 0)) {
HILOG_ERROR("parameter data is nullptr or parameter size <= 0.");
return false;
}