Skip to content

resolve compiler warnings #1246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions httplib.h
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ class ClientImpl {

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);

Expand Down Expand Up @@ -1308,7 +1308,7 @@ class Client {

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);

Expand Down Expand Up @@ -4212,10 +4212,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_;
Expand Down Expand Up @@ -6950,7 +6952,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);
}

Expand Down Expand Up @@ -8076,7 +8078,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));
}

Expand Down