mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-27 15:41:05 +08:00
Problem: type mismatch errors/warnings in Windows build
Solution: fix types
This commit is contained in:
parent
10cb710ab8
commit
dd1c87f9d9
@ -280,8 +280,8 @@ union sa_u
|
|||||||
static bool is_multicast_available (int ipv6_)
|
static bool is_multicast_available (int ipv6_)
|
||||||
{
|
{
|
||||||
int family = ipv6_ ? AF_INET6 : AF_INET;
|
int family = ipv6_ ? AF_INET6 : AF_INET;
|
||||||
int bind_sock = -1;
|
fd_t bind_sock = retired_fd;
|
||||||
int send_sock = -1;
|
fd_t send_sock = retired_fd;
|
||||||
int port = 5555;
|
int port = 5555;
|
||||||
bool success = false;
|
bool success = false;
|
||||||
const char *msg = "it works";
|
const char *msg = "it works";
|
||||||
@ -357,15 +357,15 @@ static bool is_multicast_available (int ipv6_)
|
|||||||
mreq.ipv6mr_multiaddr = mcast_ipv6->sin6_addr;
|
mreq.ipv6mr_multiaddr = mcast_ipv6->sin6_addr;
|
||||||
mreq.ipv6mr_interface = 0;
|
mreq.ipv6mr_interface = 0;
|
||||||
|
|
||||||
rc = setsockopt (bind_sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq,
|
rc = setsockopt (bind_sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP,
|
||||||
sizeof (mreq));
|
as_setsockopt_opt_t (&mreq), sizeof (mreq));
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
int loop = 1;
|
int loop = 1;
|
||||||
rc = setsockopt (send_sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &loop,
|
rc = setsockopt (send_sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP,
|
||||||
sizeof (loop));
|
as_setsockopt_opt_t (&loop), sizeof (loop));
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -376,15 +376,15 @@ static bool is_multicast_available (int ipv6_)
|
|||||||
mreq.imr_multiaddr = mcast_ipv4->sin_addr;
|
mreq.imr_multiaddr = mcast_ipv4->sin_addr;
|
||||||
mreq.imr_interface.s_addr = htonl (INADDR_ANY);
|
mreq.imr_interface.s_addr = htonl (INADDR_ANY);
|
||||||
|
|
||||||
rc = setsockopt (bind_sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq,
|
rc = setsockopt (bind_sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
|
||||||
sizeof (mreq));
|
as_setsockopt_opt_t (&mreq), sizeof (mreq));
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
int loop = 1;
|
int loop = 1;
|
||||||
rc = setsockopt (send_sock, IPPROTO_IP, IP_MULTICAST_LOOP, &loop,
|
rc = setsockopt (send_sock, IPPROTO_IP, IP_MULTICAST_LOOP,
|
||||||
sizeof (loop));
|
as_setsockopt_opt_t (&loop), sizeof (loop));
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -392,7 +392,8 @@ static bool is_multicast_available (int ipv6_)
|
|||||||
|
|
||||||
msleep (SETTLE_TIME);
|
msleep (SETTLE_TIME);
|
||||||
|
|
||||||
rc = sendto (send_sock, msg, strlen (msg), 0, &mcast.generic, sl);
|
rc = sendto (send_sock, msg, static_cast<socklen_t> (strlen (msg)), 0,
|
||||||
|
&mcast.generic, sl);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,10 @@
|
|||||||
#ifdef ZMQ_HAVE_WINDOWS
|
#ifdef ZMQ_HAVE_WINDOWS
|
||||||
#define close closesocket
|
#define close closesocket
|
||||||
typedef int socket_size_t;
|
typedef int socket_size_t;
|
||||||
|
const char *as_setsockopt_opt_t (const void *opt)
|
||||||
|
{
|
||||||
|
return static_cast<const char *> (opt);
|
||||||
|
}
|
||||||
#if defined _MSC_VER && _MSC_VER <= 1400
|
#if defined _MSC_VER && _MSC_VER <= 1400
|
||||||
typedef UINT_PTR fd_t;
|
typedef UINT_PTR fd_t;
|
||||||
enum
|
enum
|
||||||
@ -107,6 +111,10 @@ enum
|
|||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
typedef size_t socket_size_t;
|
typedef size_t socket_size_t;
|
||||||
|
const void *as_setsockopt_opt_t (const void *opt)
|
||||||
|
{
|
||||||
|
return opt;
|
||||||
|
}
|
||||||
typedef int fd_t;
|
typedef int fd_t;
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user