fix same warnings

This commit is contained in:
2019-07-14 02:29:19 +07:00
parent 442807415b
commit 39cfa6ee1b
2 changed files with 9 additions and 9 deletions

View File

@@ -51,20 +51,20 @@ namespace curly_hpp
class upload_handler {
public:
virtual ~upload_handler() {}
virtual ~upload_handler() = default;
virtual std::size_t size() const = 0;
virtual std::size_t read(char* dst, std::size_t size) = 0;
};
class download_handler {
public:
virtual ~download_handler() {}
virtual ~download_handler() = default;
virtual std::size_t write(const char* src, std::size_t size) = 0;
};
class progress_handler {
public:
virtual ~progress_handler() {}
virtual ~progress_handler() = default;
virtual float update(
std::size_t dnow, std::size_t dtotal,
std::size_t unow, std::size_t utotal) = 0;

View File

@@ -86,12 +86,12 @@ namespace
std::size_t dnow, std::size_t dtotal,
std::size_t unow, std::size_t utotal) override
{
double now_d = static_cast<double>(dnow + unow);
double total_d = static_cast<double>(dtotal + utotal);
double progress_d = total_d > 0.0
const double now_d = static_cast<double>(dnow + unow);
const double total_d = static_cast<double>(dtotal + utotal);
const float progress_d = total_d > 0.0
? static_cast<float>(now_d / total_d)
: 0.f;
return static_cast<float>(std::min(std::max(progress_d, 0.0), 1.0));
return std::min(std::max(progress_d, 0.f), 1.f);
}
};
}
@@ -685,8 +685,8 @@ namespace curly_hpp
request_builder breq_;
curlh_t curlh_{nullptr, &curl_easy_cleanup};
slist_t hlist_{nullptr, &curl_slist_free_all};
time_point_t last_response_;
time_point_t::duration response_timeout_;
time_point_t last_response_{time_point_t::clock::now()};
time_point_t::duration response_timeout_{0};
private:
response response_;
headers_t response_headers_;