diff --git a/download/dfx/dump/dump_task_info.cpp b/download/dfx/dump/dump_task_info.cpp index 7127add..72852db 100644 --- a/download/dfx/dump/dump_task_info.cpp +++ b/download/dfx/dump/dump_task_info.cpp @@ -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 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(); diff --git a/download/dfx/dump/dump_task_info.h b/download/dfx/dump/dump_task_info.h index 65f684e..acbd94a 100644 --- a/download/dfx/dump/dump_task_info.h +++ b/download/dfx/dump/dump_task_info.h @@ -32,9 +32,9 @@ public: bool Dump(int fd, const std::vector &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; diff --git a/download/interfaces/kits/js/napi/download_single/src/download_service_proxy.cpp b/download/interfaces/kits/js/napi/download_single/src/download_service_proxy.cpp index d001c13..1e99418 100644 --- a/download/interfaces/kits/js/napi/download_single/src/download_service_proxy.cpp +++ b/download/interfaces/kits/js/napi/download_single/src/download_service_proxy.cpp @@ -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::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; } diff --git a/upload/frameworks/libs/src/obtain_file.cpp b/upload/frameworks/libs/src/obtain_file.cpp index fe90178..bccf047 100644 --- a/upload/frameworks/libs/src/obtain_file.cpp +++ b/upload/frameworks/libs/src/obtain_file.cpp @@ -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(fileLength); return ret; }