Skip to content

Commit c823d70

Browse files
committed
httplib version bump compatible type rename
- use HttpClien::Progress instead of httplib::[Download]Progress
1 parent 59c95e7 commit c823d70

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Descent3/mission_download.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ bool msn_DownloadWithStatus(const char *url, const std::filesystem::path &filena
399399
}
400400

401401
httplib::Result (D3::HttpClient::*hcg)(const std::string &, const httplib::ContentReceiver &,
402-
const httplib::Progress &) = &D3::HttpClient::Get;
402+
const D3::HttpClient::Progress &) = &D3::HttpClient::Get;
403403
std::fstream in(qualfile, std::ios::binary | std::ios::trunc | std::ios::out);
404404
auto async_task = std::async(
405405
std::launch::async, hcg, &http_client, download_uri,

netcon/inetfile/httpclient.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ httplib::Result HttpClient::Get(const std::string &URIPath) {
3030
return m_client->Get(URIPath);
3131
}
3232

33-
httplib::Result HttpClient::Get(const std::string &URIPath, const httplib::Progress &progress) {
33+
httplib::Result HttpClient::Get(const std::string &URIPath, const HttpClient::Progress &progress) {
3434
return m_client->Get(URIPath, progress);
3535
}
3636

@@ -39,7 +39,7 @@ httplib::Result HttpClient::Get(const std::string &URIPath, const httplib::Conte
3939
}
4040

4141
httplib::Result HttpClient::Get(const std::string &URIPath, const httplib::ContentReceiver &content_receiver,
42-
const httplib::Progress &progress) {
42+
const HttpClient::Progress &progress) {
4343
return m_client->Get(URIPath, content_receiver, progress);
4444
}
4545

netcon/inetfile/httpclient.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ namespace D3 {
3232

3333
class HttpClient {
3434
public:
35+
using Progress = std::function<bool(size_t current, size_t total)>;
3536
/**
3637
* Constructor for HttpClient
3738
* @param URL request URL, should be in form of http://example.com. Don't add "/" on the end as it's part of URIPath.
@@ -46,12 +47,12 @@ class HttpClient {
4647
* @param URIPath requested path (for example, "/some_dir/my_file.txt")
4748
* @return standard HTTP code. 200 means is OK.
4849
*/
49-
httplib::Result Get(const std::string &URIPath, const httplib::Progress &progress);
50+
httplib::Result Get(const std::string &URIPath, const HttpClient::Progress &progress);
5051

5152
httplib::Result Get(const std::string &URIPath, const httplib::ContentReceiver &content_receiver);
5253

5354
httplib::Result Get(const std::string &URIPath, const httplib::ContentReceiver &content_receiver,
54-
const httplib::Progress &progress);
55+
const HttpClient::Progress &progress);
5556

5657
void SetProxy(const std::string &proxy_host, uint16_t port);
5758

0 commit comments

Comments
 (0)