0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-03 03:45:43 +08:00

Fixed issue #393, compilation warnings

This commit is contained in:
Pieter Hintjens 2012-07-06 12:23:51 +09:00
parent 8d96a43975
commit 9aa8452b80

View File

@ -371,12 +371,11 @@ zmq::tcp_address_t::tcp_address_t (const sockaddr *sa, socklen_t sa_len)
zmq_assert(sa && sa_len > 0);
memset (&address, 0, sizeof (address));
if (sa->sa_family == AF_INET && sa_len >= (socklen_t) sizeof (address.ipv4)) {
if (sa->sa_family == AF_INET && (size_t) sa_len >= (socklen_t) sizeof (address.ipv4))
memcpy(&address.ipv4, sa, sizeof (address.ipv4));
}
else if (sa->sa_family == AF_INET6 && sa_len >= (socklen_t) sizeof (address.ipv6)) {
else
if (sa->sa_family == AF_INET6 && (size_t) sa_len >= (socklen_t) sizeof (address.ipv6))
memcpy(&address.ipv6, sa, sizeof (address.ipv6));
}
}
zmq::tcp_address_t::~tcp_address_t ()
@ -577,7 +576,7 @@ int zmq::tcp_address_mask_t::to_string (std::string &addr_)
const bool zmq::tcp_address_mask_t::match_address (const struct sockaddr *ss, const socklen_t ss_len) const
{
zmq_assert (address_mask != -1 && ss != NULL && ss_len >= (socklen_t) sizeof (struct sockaddr));
zmq_assert (address_mask != -1 && ss != NULL && (socklen_t) ss_len >= (socklen_t) sizeof (struct sockaddr));
if (ss->sa_family != address.generic.sa_family)
return false;