diff --git a/src/tcp_address.cpp b/src/tcp_address.cpp index 708b4ef8..11e51902 100644 --- a/src/tcp_address.cpp +++ b/src/tcp_address.cpp @@ -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;