mirror of
https://github.com/yhirose/cpp-httplib
synced 2024-11-21 06:26:02 -07:00
resolve compiler warnings (#1246)
* resolve compiler warnings - check `WSAStartup` return. - `const` is not suitable for `std::move`. * resolve compiler warnings - bool startup => bool is_valid_. - remove `const` not removed.
This commit is contained in:
parent
cb41947eb4
commit
5d87cc0558
1 changed files with 8 additions and 6 deletions
14
httplib.h
14
httplib.h
|
@ -974,7 +974,7 @@ public:
|
|||
|
||||
void stop();
|
||||
|
||||
void set_hostname_addr_map(const std::map<std::string, std::string> addr_map);
|
||||
void set_hostname_addr_map(std::map<std::string, std::string> addr_map);
|
||||
|
||||
void set_default_headers(Headers headers);
|
||||
|
||||
|
@ -1309,7 +1309,7 @@ public:
|
|||
|
||||
void stop();
|
||||
|
||||
void set_hostname_addr_map(const std::map<std::string, std::string> addr_map);
|
||||
void set_hostname_addr_map(std::map<std::string, std::string> addr_map);
|
||||
|
||||
void set_default_headers(Headers headers);
|
||||
|
||||
|
@ -4231,10 +4231,12 @@ class WSInit {
|
|||
public:
|
||||
WSInit() {
|
||||
WSADATA wsaData;
|
||||
WSAStartup(0x0002, &wsaData);
|
||||
if (WSAStartup(0x0002, &wsaData) == 0) is_valid_ = true;
|
||||
}
|
||||
|
||||
~WSInit() { WSACleanup(); }
|
||||
~WSInit() { if (is_valid_) WSACleanup(); }
|
||||
|
||||
bool is_valid_ = false;
|
||||
};
|
||||
|
||||
static WSInit wsinit_;
|
||||
|
@ -6969,7 +6971,7 @@ inline void ClientImpl::set_follow_location(bool on) { follow_location_ = on; }
|
|||
inline void ClientImpl::set_url_encode(bool on) { url_encode_ = on; }
|
||||
|
||||
inline void ClientImpl::set_hostname_addr_map(
|
||||
const std::map<std::string, std::string> addr_map) {
|
||||
std::map<std::string, std::string> addr_map) {
|
||||
addr_map_ = std::move(addr_map);
|
||||
}
|
||||
|
||||
|
@ -8095,7 +8097,7 @@ inline size_t Client::is_socket_open() const { return cli_->is_socket_open(); }
|
|||
inline void Client::stop() { cli_->stop(); }
|
||||
|
||||
inline void Client::set_hostname_addr_map(
|
||||
const std::map<std::string, std::string> addr_map) {
|
||||
std::map<std::string, std::string> addr_map) {
|
||||
cli_->set_hostname_addr_map(std::move(addr_map));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue