r13856@catbus: nickm | 2007-07-20 14:30:44 -0400

slightly smarter heuristic about when to use obsolete ::a.b.c.d format.


svn:r10893
This commit is contained in:
Nick Mathewson 2007-07-20 18:30:47 +00:00
parent 9bfe9cfb40
commit 8e50aa7341

View File

@ -834,7 +834,7 @@ tor_inet_ntop(int af, const void *src, char *dst, size_t len)
words[i] = (((uint16_t)addr->s6_addr[2*i])<<8) + addr->s6_addr[2*i+1]; words[i] = (((uint16_t)addr->s6_addr[2*i])<<8) + addr->s6_addr[2*i+1];
} }
if (words[0] == 0 && words[1] == 0 && words[2] == 0 && words[3] == 0 && if (words[0] == 0 && words[1] == 0 && words[2] == 0 && words[3] == 0 &&
words[4] == 0 && ((words[5] == 0 && (words[6] || words[7])) || words[4] == 0 && ((words[5] == 0 && words[6] && words[7]) ||
(words[5] == 0xffff))) { (words[5] == 0xffff))) {
/* This is an IPv4 address. */ /* This is an IPv4 address. */
if (words[5] == 0) { if (words[5] == 0) {