mirror of
https://github.com/openharmony/miscservices_request.git
synced 2026-07-25 06:35:28 -04:00
!157 告警清零 3.2-Beta2
Merge pull request !157 from ann_lesley/OpenHarmony-3.2-Beta2
This commit is contained in:
@@ -82,7 +82,7 @@ void DumpTaskInfo::FormatDetailContent(const DownloadInfo &taskInfo, std::ostrin
|
||||
}
|
||||
}
|
||||
|
||||
bool DumpTaskInfo::DumpAllTask(int fd)
|
||||
bool DumpTaskInfo::DumpAllTask(int fd) const
|
||||
{
|
||||
std::vector<DownloadInfo> taskVector;
|
||||
auto instance = DownloadServiceManager::GetInstance();
|
||||
@@ -107,7 +107,7 @@ bool DumpTaskInfo::DumpAllTask(int fd)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DumpTaskInfo::DumpTaskDetailInfo(int fd, uint32_t taskId)
|
||||
bool DumpTaskInfo::DumpTaskDetailInfo(int fd, uint32_t taskId) const
|
||||
{
|
||||
DownloadInfo downloadInfo;
|
||||
auto instance = DownloadServiceManager::GetInstance();
|
||||
|
||||
@@ -32,9 +32,9 @@ public:
|
||||
bool Dump(int fd, const std::vector<std::string> &args) override;
|
||||
private:
|
||||
void DumpAllTaskTile(int fd) const;
|
||||
bool DumpAllTask(int fd);
|
||||
bool DumpAllTask(int fd) const;
|
||||
void DumpTaskDetailInfoTile(int fd) const;
|
||||
bool DumpTaskDetailInfo(int fd, uint32_t taskId);
|
||||
bool DumpTaskDetailInfo(int fd, uint32_t taskId) const;
|
||||
void FormatSummaryTitle(std::ostringstream &buffer) const;
|
||||
void FormatDetailTitle(std::ostringstream &buffer) const;
|
||||
void FormatSummaryContent(const DownloadInfo &taskInfo, std::ostringstream &buffer) const;
|
||||
|
||||
@@ -49,10 +49,8 @@ int32_t DownloadServiceProxy::Request(const DownloadConfig &config)
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
data.WriteInterfaceToken(GetDescriptor());
|
||||
|
||||
int32_t fd = -1;
|
||||
int32_t err = 0;
|
||||
|
||||
if (!IsPathValid(config.GetFilePath())) {
|
||||
return -1;
|
||||
}
|
||||
@@ -68,8 +66,6 @@ int32_t DownloadServiceProxy::Request(const DownloadConfig &config)
|
||||
err = errno;
|
||||
}
|
||||
}
|
||||
|
||||
DOWNLOAD_HILOGI("Succeed to open download file, fd [%{public}d]]", fd);
|
||||
data.WriteFileDescriptor(fd);
|
||||
if (fd > 0) {
|
||||
close(fd);
|
||||
@@ -83,22 +79,18 @@ int32_t DownloadServiceProxy::Request(const DownloadConfig &config)
|
||||
data.WriteString(config.GetFilePath());
|
||||
data.WriteString(config.GetTitle());
|
||||
data.WriteUint32(config.GetHeader().size());
|
||||
|
||||
std::map<std::string, std::string>::const_iterator iter;
|
||||
for (iter = config.GetHeader().begin(); iter != config.GetHeader().end(); ++iter) {
|
||||
data.WriteString(iter->first);
|
||||
data.WriteString(iter->second);
|
||||
}
|
||||
|
||||
config.Dump();
|
||||
DOWNLOAD_HILOGD("DownloadServiceProxy Request started.");
|
||||
bool ret = Remote()->SendRequest(CMD_REQUEST, data, reply, option);
|
||||
if (ret != ERR_NONE) {
|
||||
DOWNLOAD_HILOGE("Request, ret = %{public}d", ret);
|
||||
return -1;
|
||||
}
|
||||
int32_t taskId = reply.ReadInt32();
|
||||
DOWNLOAD_HILOGD("DownloadServiceProxy Request succeeded. TaskId = %{public}d", taskId);
|
||||
return taskId;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,11 +59,11 @@ uint32_t ObtainFile::GetDataAbilityFile(FILE **file, std::string &fileUri,
|
||||
{
|
||||
uint32_t ret = UPLOAD_ERRORCODE_NO_ERROR;
|
||||
FILE *filePtr = nullptr;
|
||||
uint32_t fileLength = 0;
|
||||
int32_t fileLength = 0;
|
||||
|
||||
do {
|
||||
uint32_t fd = fileAdapter_->DataAbilityOpenFile(fileUri, context);
|
||||
if (fd == -1) {
|
||||
if (fd < 0) {
|
||||
UPLOAD_HILOGE(UPLOAD_MODULE_FRAMEWORK, "ObtainFile::GetDataAbilityFile, open file error.");
|
||||
ret = UPLOAD_ERRORCODE_GET_FILE_ERROR;
|
||||
break;
|
||||
@@ -87,7 +87,7 @@ uint32_t ObtainFile::GetDataAbilityFile(FILE **file, std::string &fileUri,
|
||||
} while (0);
|
||||
|
||||
*file = filePtr;
|
||||
fileSize = fileLength;
|
||||
fileSize = static_cast<uint32_t>(fileLength);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user