提交 aaeea2df authored 作者: Brian West's avatar Brian West 提交者: Ken Rice

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

上级 459ccb01
...@@ -48,11 +48,12 @@ ...@@ -48,11 +48,12 @@
#ifndef WIN32 #ifndef WIN32
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "mcast.h"
#ifndef WIN32 #ifndef WIN32
#include <poll.h> #include <poll.h>
#endif #endif
#include <switch_utils.h> #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) 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, ...@@ -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_addr.s_addr = inet_addr(host);
handle->send_addr.sin_port = htons(port); 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); close(handle->sock);
return -1; return -1;
} }
...@@ -84,7 +85,7 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, ...@@ -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_multiaddr.s_addr = inet_addr(host);
mreq.imr_interface.s_addr = htonl(INADDR_ANY); 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); close(handle->sock);
handle->sock = -1; handle->sock = -1;
return -1; return -1;
...@@ -125,7 +126,7 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, ...@@ -125,7 +126,7 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle,
handle->ttl = 255; 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; return -1;
} }
......
...@@ -1518,7 +1518,7 @@ new_req: ...@@ -1518,7 +1518,7 @@ new_req:
!strncmp(request.content_type, "application/x-www-form-urlencoded", 33)) { !strncmp(request.content_type, "application/x-www-form-urlencoded", 33)) {
char *buffer = NULL; char *buffer = NULL;
int len = 0, bytes = 0; switch_size_t len = 0, bytes = 0;
if (request.content_length > 2 * 1024 * 1024 - 1) { if (request.content_length > 2 * 1024 * 1024 - 1) {
char *data = "HTTP/1.1 413 Request Entity Too Large\r\n" char *data = "HTTP/1.1 413 Request Entity Too Large\r\n"
...@@ -3737,7 +3737,7 @@ static int start_jsock(verto_profile_t *profile, ws_socket_t sock) ...@@ -3737,7 +3737,7 @@ static int start_jsock(verto_profile_t *profile, ws_socket_t sock)
return -1; 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; ws_socket_t sock = ws_sock_invalid;
#ifndef WIN32 #ifndef WIN32
...@@ -3842,7 +3842,7 @@ static int profile_one_loop(verto_profile_t *profile) ...@@ -3842,7 +3842,7 @@ static int profile_one_loop(verto_profile_t *profile)
} }
if (pfds[x].revents & SWITCH_POLL_READ) { 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); handle_mcast_sub(profile);
} else { } else {
start_jsock(profile, pfds[x].sock); start_jsock(profile, pfds[x].sock);
...@@ -3971,7 +3971,7 @@ static void do_shutdown(void) ...@@ -3971,7 +3971,7 @@ static void do_shutdown(void)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Done\n"); 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; char *p;
struct hostent *hent; struct hostent *hent;
...@@ -3980,7 +3980,7 @@ static void parse_ip(char *host, int *port, in_addr_t *addr, char *input) ...@@ -3980,7 +3980,7 @@ static void parse_ip(char *host, int *port, in_addr_t *addr, char *input)
if ((p = strchr(host, ':')) != NULL) { if ((p = strchr(host, ':')) != NULL) {
*p++ = '\0'; *p++ = '\0';
*port = atoi(p); *port = (uint16_t)atoi(p);
} }
if ( host[0] < '0' || host[0] > '9' ) { if ( host[0] < '0' || host[0] > '9' ) {
......
...@@ -156,7 +156,7 @@ typedef struct jsock_s jsock_t; ...@@ -156,7 +156,7 @@ typedef struct jsock_s jsock_t;
struct ips { struct ips {
char local_ip[256]; char local_ip[256];
in_addr_t local_ip_addr; in_addr_t local_ip_addr;
int local_port; uint16_t local_port;
int secure; int secure;
}; };
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论