Skip to content
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

Fixed casting warnings on linux and macOS #46

Merged
merged 3 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion resolver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions wpad_dhcp_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#ifdef _WIN32
# define socketerr WSAGetLastError()
# define ssize_t int
#else
# define socketerr errno
# define SOCKET int
Expand Down Expand Up @@ -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;
}
Expand Down