[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r11162: Another attempt to confirm to msvc for bug 482. (in tor/trunk: . src/common)



Author: nickm
Date: 2007-08-17 21:38:11 -0400 (Fri, 17 Aug 2007)
New Revision: 11162

Modified:
   tor/trunk/
   tor/trunk/src/common/compat.h
Log:
 r14651@catbus:  nickm | 2007-08-17 21:37:03 -0400
 Another attempt to confirm to msvc for bug 482.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r14651] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/src/common/compat.h
===================================================================
--- tor/trunk/src/common/compat.h	2007-08-17 22:55:04 UTC (rev 11161)
+++ tor/trunk/src/common/compat.h	2007-08-18 01:38:11 UTC (rev 11162)
@@ -338,6 +338,15 @@
 static INLINE const struct in6_addr *IN6_ADDRESS(const tor_addr_t *a);
 static INLINE uint16_t IN_PORT(const tor_addr_t *a);
 
+static INLINE const struct in6_addr *
+IN6_ADDRESS(const tor_addr_t *a)
+{
+  return &a->sa6.sin6_addr;
+}
+
+#define IN6_ADDRESS16(x) S6_ADDR16(*IN6_ADDRESS(x))
+#define IN6_ADDRESS32(x) S6_ADDR32(*IN6_ADDRESS(x))
+
 static INLINE uint32_t
 IPV4IP(const tor_addr_t *a)
 {
@@ -351,7 +360,7 @@
 static INLINE uint32_t
 IPV4MAPh(const tor_addr_t *a)
 {
-  return ntohl(a->sa6.sin6_addr.s6_addr32[3]);
+  return ntohl(IN6_ADDRESS32(a)[3]);
 }
 static INLINE uint16_t
 IN_FAMILY(const tor_addr_t *a)
@@ -363,11 +372,6 @@
 {
   return &a->sa.sin_addr;
 }
-static INLINE const struct in6_addr *
-IN6_ADDRESS(const tor_addr_t *a)
-{
-  return &a->sa6.sin6_addr;
-}
 static INLINE uint16_t
 IN_PORT(const tor_addr_t *a)
 {
@@ -377,9 +381,6 @@
     return a->sa6.sin6_port;
 }
 
-#define IN6_ADDRESS16(x) S6_ADDR16(*IN6_ADDRESS(x))
-#define IN6_ADDRESS32(x) S6_ADDR32(*IN6_ADDRESS(x))
-
 #define INET_NTOA_BUF_LEN 16 /* 255.255.255.255 */
 #define TOR_ADDR_BUF_LEN 46 /* ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255 */