FS-7046: fix data types and casting on some vars to silence windows build warnings

This commit is contained in:
Brian West 2014-12-03 15:06:31 -06:00
parent e8cf9c7d35
commit b341ff7c1f
3 changed files with 11 additions and 10 deletions

View File

@ -48,11 +48,12 @@
#ifndef WIN32
#include <unistd.h>
#endif
#include "mcast.h"
#ifndef WIN32
#include <poll.h>
#endif
#include <switch_utils.h>
#include "mcast.h"
int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, mcast_flag_t flags)
{
@ -68,7 +69,7 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle,
handle->send_addr.sin_addr.s_addr = inet_addr(host);
handle->send_addr.sin_port = htons(port);
if ( setsockopt(handle->sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)) != 0 ) {
if ( setsockopt(handle->sock, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(one)) != 0 ) {
close(handle->sock);
return -1;
}
@ -84,7 +85,7 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle,
mreq.imr_multiaddr.s_addr = inet_addr(host);
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
if (setsockopt(handle->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)) < 0) {
if (setsockopt(handle->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (void *)&mreq, sizeof(mreq)) < 0) {
close(handle->sock);
handle->sock = -1;
return -1;
@ -125,7 +126,7 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle,
handle->ttl = 255;
}
if ( setsockopt(handle->sock, IPPROTO_IP, IP_MULTICAST_TTL, &handle->ttl, sizeof(handle->ttl)) != 0 ) {
if ( setsockopt(handle->sock, IPPROTO_IP, IP_MULTICAST_TTL, (void *)&handle->ttl, sizeof(handle->ttl)) != 0 ) {
return -1;
}

View File

@ -1518,7 +1518,7 @@ new_req:
!strncmp(request.content_type, "application/x-www-form-urlencoded", 33)) {
char *buffer = NULL;
int len = 0, bytes = 0;
switch_size_t len = 0, bytes = 0;
if (request.content_length > 2 * 1024 * 1024 - 1) {
char *data = "HTTP/1.1 413 Request Entity Too Large\r\n"
@ -3735,7 +3735,7 @@ static int start_jsock(verto_profile_t *profile, ws_socket_t sock)
return -1;
}
static ws_socket_t prepare_socket(int ip, int port)
static ws_socket_t prepare_socket(int ip, uint16_t port)
{
ws_socket_t sock = ws_sock_invalid;
#ifndef WIN32
@ -3840,7 +3840,7 @@ static int profile_one_loop(verto_profile_t *profile)
}
if (pfds[x].revents & SWITCH_POLL_READ) {
if (profile->mcast_ip && pfds[x].sock == profile->mcast_sub.sock) {
if (profile->mcast_ip && pfds[x].sock == (switch_os_socket_t)profile->mcast_sub.sock) {
handle_mcast_sub(profile);
} else {
start_jsock(profile, pfds[x].sock);
@ -3969,7 +3969,7 @@ static void do_shutdown(void)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Done\n");
}
static void parse_ip(char *host, int *port, in_addr_t *addr, char *input)
static void parse_ip(char *host, uint16_t *port, in_addr_t *addr, char *input)
{
char *p;
struct hostent *hent;
@ -3978,7 +3978,7 @@ static void parse_ip(char *host, int *port, in_addr_t *addr, char *input)
if ((p = strchr(host, ':')) != NULL) {
*p++ = '\0';
*port = atoi(p);
*port = (uint16_t)atoi(p);
}
if ( host[0] < '0' || host[0] > '9' ) {

View File

@ -156,7 +156,7 @@ typedef struct jsock_s jsock_t;
struct ips {
char local_ip[256];
in_addr_t local_ip_addr;
int local_port;
uint16_t local_port;
int secure;
};