From d7314545312893f67566398d279575f9b67190c4 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 28 Aug 2018 23:20:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- c_wrapper/src/httpdownloader.cpp | 8 +++++++- c_wrapper/src/httpdownloader.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/c_wrapper/src/httpdownloader.cpp b/c_wrapper/src/httpdownloader.cpp index b59a1072..e850aa07 100755 --- a/c_wrapper/src/httpdownloader.cpp +++ b/c_wrapper/src/httpdownloader.cpp @@ -57,14 +57,20 @@ API_EXPORT HttpDownloaderContex API_CALL createDownloader(){ return ret.get(); } API_EXPORT void API_CALL downloader_startDownload(HttpDownloaderContex ctx,const char *url,downloader_onResult cb,void *userData){ + downloader_startDownload_l(ctx,url,"",cb,userData); +} + + +API_EXPORT void API_CALL downloader_startDownload_l(HttpDownloaderContex ctx,const char *url,const char *file,downloader_onResult cb,void *userData){ HttpDownloader *ptr = (HttpDownloader *)ctx; string urlTmp(url); - ptr->startDownload(url, [cb,userData,urlTmp](int code,const char *errMsg,const char *filePath){ + ptr->setOnResult([cb,userData,urlTmp](int code,const char *errMsg,const char *filePath){ if(cb){ InfoL << code << " " << errMsg << " " << filePath << " " << urlTmp; cb(userData,code,errMsg,filePath); } }); + ptr->startDownload(url,file,false); } API_EXPORT void API_CALL releaseDownloader(HttpDownloaderContex ctx){ lock_guard lck(s_mtxMapDownloader); diff --git a/c_wrapper/src/httpdownloader.h b/c_wrapper/src/httpdownloader.h index fbb98667..1e325fe6 100755 --- a/c_wrapper/src/httpdownloader.h +++ b/c_wrapper/src/httpdownloader.h @@ -39,6 +39,7 @@ typedef void(API_CALL *downloader_onResult)(void *userData,int code,const char * API_EXPORT HttpDownloaderContex API_CALL createDownloader(); API_EXPORT void API_CALL downloader_startDownload(HttpDownloaderContex ctx,const char *url,downloader_onResult cb,void *userData); +API_EXPORT void API_CALL downloader_startDownload_l(HttpDownloaderContex ctx,const char *url,const char *file,downloader_onResult cb,void *userData); API_EXPORT void API_CALL releaseDownloader(HttpDownloaderContex ctx);