summaryrefslogtreecommitdiffstats
path: root/nsprpub/pr/src/misc/prnetdb.c
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-02-06 11:40:35 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-02-06 11:40:35 +0100
commit7c728b3c7680662fc4e92b5d03697b8339560b08 (patch)
tree4a0da02f99913e0d52acd52067ad5a7be29e99a3 /nsprpub/pr/src/misc/prnetdb.c
parent13e9a0c06d35bb02d211df873c105a350aeab8eb (diff)
downloadUXP-7c728b3c7680662fc4e92b5d03697b8339560b08.tar
UXP-7c728b3c7680662fc4e92b5d03697b8339560b08.tar.gz
UXP-7c728b3c7680662fc4e92b5d03697b8339560b08.tar.lz
UXP-7c728b3c7680662fc4e92b5d03697b8339560b08.tar.xz
UXP-7c728b3c7680662fc4e92b5d03697b8339560b08.zip
Update NSPR to 4.16
Diffstat (limited to 'nsprpub/pr/src/misc/prnetdb.c')
-rw-r--r--nsprpub/pr/src/misc/prnetdb.c49
1 files changed, 20 insertions, 29 deletions
diff --git a/nsprpub/pr/src/misc/prnetdb.c b/nsprpub/pr/src/misc/prnetdb.c
index b2f6e435b..affebf6ac 100644
--- a/nsprpub/pr/src/misc/prnetdb.c
+++ b/nsprpub/pr/src/misc/prnetdb.c
@@ -1405,7 +1405,7 @@ PR_IMPLEMENT(PRStatus) PR_InitializeNetAddr(
PRStatus rv = PR_SUCCESS;
if (!_pr_initialized) _PR_ImplicitInitialization();
- if (val != PR_IpAddrNull) memset(addr, 0, sizeof(addr->inet));
+ if (val != PR_IpAddrNull) memset(addr, 0, sizeof(*addr));
addr->inet.family = AF_INET;
addr->inet.port = htons(port);
switch (val)
@@ -1483,18 +1483,20 @@ PR_IsNetAddrType(const PRNetAddr *addr, PRNetAddrValue val)
if (val == PR_IpAddrAny) {
if (_PR_IN6_IS_ADDR_UNSPECIFIED((PRIPv6Addr *)&addr->ipv6.ip)) {
return PR_TRUE;
- } else if (_PR_IN6_IS_ADDR_V4MAPPED((PRIPv6Addr *)&addr->ipv6.ip)
- && _PR_IN6_V4MAPPED_TO_IPADDR((PRIPv6Addr *)&addr->ipv6.ip)
- == htonl(INADDR_ANY)) {
- return PR_TRUE;
+ }
+ if (_PR_IN6_IS_ADDR_V4MAPPED((PRIPv6Addr *)&addr->ipv6.ip)
+ && _PR_IN6_V4MAPPED_TO_IPADDR((PRIPv6Addr *)&addr->ipv6.ip)
+ == htonl(INADDR_ANY)) {
+ return PR_TRUE;
}
} else if (val == PR_IpAddrLoopback) {
if (_PR_IN6_IS_ADDR_LOOPBACK((PRIPv6Addr *)&addr->ipv6.ip)) {
return PR_TRUE;
- } else if (_PR_IN6_IS_ADDR_V4MAPPED((PRIPv6Addr *)&addr->ipv6.ip)
- && _PR_IN6_V4MAPPED_TO_IPADDR((PRIPv6Addr *)&addr->ipv6.ip)
- == htonl(INADDR_LOOPBACK)) {
- return PR_TRUE;
+ }
+ if (_PR_IN6_IS_ADDR_V4MAPPED((PRIPv6Addr *)&addr->ipv6.ip)
+ && _PR_IN6_V4MAPPED_TO_IPADDR((PRIPv6Addr *)&addr->ipv6.ip)
+ == htonl(INADDR_LOOPBACK)) {
+ return PR_TRUE;
}
} else if (val == PR_IpAddrV4Mapped
&& _PR_IN6_IS_ADDR_V4MAPPED((PRIPv6Addr *)&addr->ipv6.ip)) {
@@ -1504,8 +1506,9 @@ PR_IsNetAddrType(const PRNetAddr *addr, PRNetAddrValue val)
if (addr->raw.family == AF_INET) {
if (val == PR_IpAddrAny && addr->inet.ip == htonl(INADDR_ANY)) {
return PR_TRUE;
- } else if (val == PR_IpAddrLoopback
- && addr->inet.ip == htonl(INADDR_LOOPBACK)) {
+ }
+ if (val == PR_IpAddrLoopback
+ && addr->inet.ip == htonl(INADDR_LOOPBACK)) {
return PR_TRUE;
}
}
@@ -1777,18 +1780,12 @@ PR_IMPLEMENT(PRUint64) PR_ntohll(PRUint64 n)
#ifdef IS_BIG_ENDIAN
return n;
#else
- PRUint64 tmp;
PRUint32 hi, lo;
- LL_L2UI(lo, n);
- LL_SHR(tmp, n, 32);
- LL_L2UI(hi, tmp);
+ lo = (PRUint32)n;
+ hi = (PRUint32)(n >> 32);
hi = PR_ntohl(hi);
lo = PR_ntohl(lo);
- LL_UI2L(n, lo);
- LL_SHL(n, n, 32);
- LL_UI2L(tmp, hi);
- LL_ADD(n, n, tmp);
- return n;
+ return ((PRUint64)lo << 32) + (PRUint64)hi;
#endif
} /* ntohll */
@@ -1797,18 +1794,12 @@ PR_IMPLEMENT(PRUint64) PR_htonll(PRUint64 n)
#ifdef IS_BIG_ENDIAN
return n;
#else
- PRUint64 tmp;
PRUint32 hi, lo;
- LL_L2UI(lo, n);
- LL_SHR(tmp, n, 32);
- LL_L2UI(hi, tmp);
+ lo = (PRUint32)n;
+ hi = (PRUint32)(n >> 32);
hi = htonl(hi);
lo = htonl(lo);
- LL_UI2L(n, lo);
- LL_SHL(n, n, 32);
- LL_UI2L(tmp, hi);
- LL_ADD(n, n, tmp);
- return n;
+ return ((PRUint64)lo << 32) + (PRUint64)hi;
#endif
} /* htonll */