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

[or-cvs] r6985: Oops. Fix downcast macro. (in tor/trunk: . src/or)



Author: nickm
Date: 2006-08-05 13:52:51 -0400 (Sat, 05 Aug 2006)
New Revision: 6985

Modified:
   tor/trunk/
   tor/trunk/src/or/or.h
Log:
 r7027@Kushana:  nickm | 2006-08-04 13:06:48 -0700
 Oops. Fix downcast macro.



Property changes on: tor/trunk
___________________________________________________________________
Name: svk:merge
   - 1f724f9b-111a-0410-b636-93f1a77c1813:/local/or/tor/trunk:8207
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/eventdns:7014
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/mmap:7025
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/oo-connections:6950
   + 1f724f9b-111a-0410-b636-93f1a77c1813:/local/or/tor/trunk:8207
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/eventdns:7014
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/mmap:7027
c95137ef-5f19-0410-b913-86e773d04f59:/tor/branches/oo-connections:6950

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2006-08-05 03:08:56 UTC (rev 6984)
+++ tor/trunk/src/or/or.h	2006-08-05 17:52:51 UTC (rev 6985)
@@ -776,8 +776,8 @@
 /** Cast a connection_t subtype pointer to a connection_t **/
 #define TO_CONN(c) &(((c)->_base))
 /** Helper macro: Given a pointer to to._base, of type from*, return &to. */
-#define DOWNCAST(from, to, ptr) \
-  (to*) (((from*)(ptr)) - STRUCT_OFFSET(to, _base))
+#define DOWNCAST(to, ptr) \
+  (to*) (((char*)(ptr)) - STRUCT_OFFSET(to, _base))
 
 /** Convert a connection_t* to an or_connection_t*; assert if the cast is
  * invalid. */
@@ -795,22 +795,22 @@
 extern INLINE or_connection_t *TO_OR_CONN(connection_t *c)
 {
   tor_assert(c->magic == OR_CONNECTION_MAGIC);
-  return DOWNCAST(connection_t, or_connection_t, c);
+  return DOWNCAST(or_connection_t, c);
 }
 extern INLINE dir_connection_t *TO_DIR_CONN(connection_t *c)
 {
   tor_assert(c->magic == DIR_CONNECTION_MAGIC);
-  return DOWNCAST(connection_t, dir_connection_t, c);
+  return DOWNCAST(dir_connection_t, c);
 }
 extern INLINE edge_connection_t *TO_EDGE_CONN(connection_t *c)
 {
   tor_assert(c->magic == EDGE_CONNECTION_MAGIC);
-  return DOWNCAST(connection_t, edge_connection_t, c);
+  return DOWNCAST(edge_connection_t, c);
 }
 extern INLINE control_connection_t *TO_CONTROL_CONN(connection_t *c)
 {
   tor_assert(c->magic == CONTROL_CONNECTION_MAGIC);
-  return DOWNCAST(connection_t, control_connection_t, c);
+  return DOWNCAST(control_connection_t, c);
 }
 
 typedef enum {
@@ -1305,14 +1305,14 @@
 {
   tor_assert(x->magic == OR_CIRCUIT_MAGIC);
   //return (or_circuit_t*) (((char*)x) - STRUCT_OFFSET(or_circuit_t, _base));
-  return DOWNCAST(circuit_t, or_circuit_t, x);
+  return DOWNCAST(or_circuit_t, x);
 }
 extern INLINE origin_circuit_t *TO_ORIGIN_CIRCUIT(circuit_t *x)
 {
   tor_assert(x->magic == ORIGIN_CIRCUIT_MAGIC);
   //return (origin_circuit_t*)
   //  (((char*)x) - STRUCT_OFFSET(origin_circuit_t, _base));
-  return DOWNCAST(circuit_t, origin_circuit_t, x);
+  return DOWNCAST(origin_circuit_t, x);
 }
 
 #define ALLOW_INVALID_ENTRY        1