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

[tor-commits] [tor/master] more consistently use [gs]et_uint8



commit 57b13ad5cc9423f53a105e5d0c0a83246e68adfc
Author: Roger Dingledine <arma@xxxxxxxxxxxxxx>
Date:   Tue Oct 2 20:39:58 2012 -0400

    more consistently use [gs]et_uint8
---
 src/or/connection_or.c |    4 ++--
 src/or/relay.c         |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 02345f9..dbd8757 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -296,7 +296,7 @@ cell_pack(packed_cell_t *dst, const cell_t *src)
 {
   char *dest = dst->body;
   set_uint16(dest, htons(src->circ_id));
-  *(uint8_t*)(dest+2) = src->command;
+  set_uint8(dest+2, src->command);
   memcpy(dest+3, src->payload, CELL_PAYLOAD_SIZE);
 }
 
@@ -307,7 +307,7 @@ static void
 cell_unpack(cell_t *dest, const char *src)
 {
   dest->circ_id = ntohs(get_uint16(src));
-  dest->command = *(uint8_t*)(src+2);
+  dest->command = get_uint8(src+2);
   memcpy(dest->payload, src+3, CELL_PAYLOAD_SIZE);
 }
 
diff --git a/src/or/relay.c b/src/or/relay.c
index 7910915..54f6634 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -1231,7 +1231,7 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
         return 0;
       }
       if (circ->n_conn) {
-        uint8_t trunc_reason = *(uint8_t*)(cell->payload + RELAY_HEADER_SIZE);
+        uint8_t trunc_reason = get_uint8(cell->payload + RELAY_HEADER_SIZE);
         circuit_clear_cell_queue(circ, circ->n_conn);
         connection_or_send_destroy(circ->n_circ_id, circ->n_conn,
                                    trunc_reason);

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits