diff --git a/CMakeLists.txt b/CMakeLists.txt index 236b972..2d7c476 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -236,7 +236,9 @@ if(PROXYRES_CURL AND (PROXYRES_EXECUTE OR PROXYRES_BUILD_CLI)) add_subdirectory(${curl_SOURCE_DIR} ${curl_BINARY_DIR} EXCLUDE_FROM_ALL) endif() - add_library(CURL::libcurl ALIAS libcurl) + if(NOT TARGET CURL::libcurl) + add_library(CURL::libcurl ALIAS libcurl) + endif() endif() endif() diff --git a/resolver.c b/resolver.c index a2aef59..34a0bb6 100644 --- a/resolver.c +++ b/resolver.c @@ -92,7 +92,7 @@ static bool proxy_resolver_get_proxies_for_url_from_system_config(void *ctx, con } else { // Construct proxy list url using scheme associated with proxy's port if available, // otherwise continue to use scheme associated with the url. - const int32_t proxy_port = get_host_port(proxy, strlen(proxy), 0); + const uint16_t proxy_port = get_host_port(proxy, strlen(proxy), 0); const char *proxy_scheme = proxy_port ? get_port_scheme(proxy_port, scheme) : scheme; // Use proxy from settings diff --git a/wpad_dhcp_posix.c b/wpad_dhcp_posix.c index c4342fc..8139a20 100644 --- a/wpad_dhcp_posix.c +++ b/wpad_dhcp_posix.c @@ -24,6 +24,7 @@ #ifdef _WIN32 # define socketerr WSAGetLastError() +# define ssize_t int #else # define socketerr errno # define SOCKET int @@ -168,15 +169,16 @@ static bool dhcp_send_inform(SOCKET sfd, uint32_t xid, net_adapter_s *adapter) { opts = dhcp_copy_option(opts, &opt_end); // Broadcast DHCP request - int32_t request_len = (int32_t)(opts - (uint8_t *)&request); - int sent = sendto(sfd, (const char *)&request, request_len, 0, (struct sockaddr *)&address, sizeof(address)); + const ssize_t request_len = (ssize_t)(opts - (uint8_t *)&request); + const ssize_t sent = + sendto(sfd, (const char *)&request, request_len, 0, (struct sockaddr *)&address, sizeof(address)); return sent == request_len; } static bool dhcp_read_reply(SOCKET sfd, uint32_t request_xid, dhcp_msg *reply) { - int response_len = recvfrom(sfd, (char *)reply, sizeof(dhcp_msg), 0, NULL, NULL); + const ssize_t response_len = recvfrom(sfd, (char *)reply, sizeof(dhcp_msg), 0, NULL, NULL); - if (response_len <= (int)(sizeof(dhcp_msg) - DHCP_OPT_MIN_LENGTH)) { + if (response_len <= (ssize_t)(sizeof(dhcp_msg) - DHCP_OPT_MIN_LENGTH)) { LOG_DEBUG("Unable to read DHCP reply (%d:%d)\n", response_len, socketerr); return false; }