diff --git a/download/interfaces/kits/js/napi/download_single/include/legacy/download_manager.h b/download/interfaces/kits/js/napi/download_single/include/legacy/download_manager.h index 5182098..c7ec8a6 100644 --- a/download/interfaces/kits/js/napi/download_single/include/legacy/download_manager.h +++ b/download/interfaces/kits/js/napi/download_single/include/legacy/download_manager.h @@ -79,4 +79,4 @@ private: static inline const std::string URI_PREFIX = "internal://cache/"; }; } -#endif //LEGACY_DOWNLOAD_MANAGER_H \ No newline at end of file +#endif // LEGACY_DOWNLOAD_MANAGER_H \ No newline at end of file diff --git a/download/interfaces/kits/js/napi/download_single/include/legacy/download_task.h b/download/interfaces/kits/js/napi/download_single/include/legacy/download_task.h index 5a23297..9b60468 100644 --- a/download/interfaces/kits/js/napi/download_single/include/legacy/download_task.h +++ b/download/interfaces/kits/js/napi/download_single/include/legacy/download_task.h @@ -57,4 +57,4 @@ private: static bool isCurlGlobalInited_; }; } -#endif //LEGACY_DOWNLOAD_TASK_H \ No newline at end of file +#endif // LEGACY_DOWNLOAD_TASK_H \ No newline at end of file diff --git a/download/interfaces/kits/js/napi/download_single/src/legacy/download_manager.cpp b/download/interfaces/kits/js/napi/download_single/src/legacy/download_manager.cpp index e81d21d..128e85b 100644 --- a/download/interfaces/kits/js/napi/download_single/src/legacy/download_manager.cpp +++ b/download/interfaces/kits/js/napi/download_single/src/legacy/download_manager.cpp @@ -93,22 +93,21 @@ void DownloadManager::OnTaskDone(const std::string &token, bool successful, cons if (successful && descriptor.successCb_) { CallFunctionAsync(descriptor.env_, descriptor.successCb_, - [descriptor](napi_env env, napi_ref *recv, int &argc, napi_value *argv) { - *recv = descriptor.this_; - argc = SUCCESS_CB_ARGC; - argv[0] = NapiUtils::CreateObject(descriptor.env_); - NapiUtils::SetStringPropertyUtf8(descriptor.env_, argv[0], "uri", - URI_PREFIX + descriptor.filename_); - }); + [descriptor](napi_env env, napi_ref *recv, int &argc, napi_value *argv) { + *recv = descriptor.this_; + argc = SUCCESS_CB_ARGC; + argv[0] = NapiUtils::CreateObject(descriptor.env_); + NapiUtils::SetStringPropertyUtf8(descriptor.env_, argv[0], "uri", URI_PREFIX + descriptor.filename_); + }); } if (!successful && descriptor.failCb_) { CallFunctionAsync(descriptor.env_, descriptor.failCb_, - [descriptor, errMsg](napi_env env, napi_ref *recv, int &argc, napi_value *argv) { - *recv = descriptor.this_; - argc = FAIL_CB_ARGC; - argv[0] = NapiUtils::CreateStringUtf8(descriptor.env_, errMsg); - argv[1] = NapiUtils::CreateInt32(descriptor.env_, FAIL_CB_DOWNLOAD_ERROR); - }); + [descriptor, errMsg](napi_env env, napi_ref *recv, int &argc, napi_value *argv) { + *recv = descriptor.this_; + argc = FAIL_CB_ARGC; + argv[0] = NapiUtils::CreateStringUtf8(descriptor.env_, errMsg); + argv[1] = NapiUtils::CreateInt32(descriptor.env_, FAIL_CB_DOWNLOAD_ERROR); + }); } delete descriptor.task_; } diff --git a/download/interfaces/kits/js/napi/download_single/src/legacy/download_task.cpp b/download/interfaces/kits/js/napi/download_single/src/legacy/download_task.cpp index 5118f55..3c9feea 100644 --- a/download/interfaces/kits/js/napi/download_single/src/legacy/download_task.cpp +++ b/download/interfaces/kits/js/napi/download_single/src/legacy/download_task.cpp @@ -14,7 +14,6 @@ */ #include "legacy/download_task.h" -#include #include "log.h" namespace OHOS::Request::Download::Legacy {