Skip to content

Commit

Permalink
Fixed casting warnings on linux and macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoinvaz committed Aug 1, 2023
1 parent fbab477 commit b772d03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
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
9 changes: 5 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,15 @@ 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));
ssize_t request_len = (ssize_t)(opts - (uint8_t *)&request);
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);
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

0 comments on commit b772d03

Please sign in to comment.