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

[or-cvs] Make Tor compile with no warnings with gcc4.0 on OSX



Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv25012/src/or

Modified Files:
	circuitbuild.c command.c connection.c connection_edge.c 
	cpuworker.c dns.c onion.c or.h routerparse.c 
Log Message:
Make Tor compile with no warnings with gcc4.0 on OSX

Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- circuitbuild.c	3 May 2005 10:04:07 -0000	1.112
+++ circuitbuild.c	7 May 2005 05:55:06 -0000	1.113
@@ -676,7 +676,7 @@
  * Return -1 if we want to mark circ for close, else return 0.
  */
 int circuit_finish_handshake(circuit_t *circ, uint8_t reply_type, char *reply) {
-  unsigned char keys[CPATH_KEY_MATERIAL_LEN];
+  char keys[CPATH_KEY_MATERIAL_LEN];
   crypt_path_t *hop;
 
   tor_assert(CIRCUIT_IS_ORIGIN(circ));
@@ -778,7 +778,7 @@
 /** Given a response payload and keys, initialize, then send a created
  * cell back.
  */
-int onionskin_answer(circuit_t *circ, uint8_t cell_type, unsigned char *payload, unsigned char *keys) {
+int onionskin_answer(circuit_t *circ, uint8_t cell_type, char *payload, char *keys) {
   cell_t cell;
   crypt_path_t *tmp_cpath;
 

Index: command.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/command.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- command.c	3 May 2005 10:04:07 -0000	1.86
+++ command.c	7 May 2005 05:55:06 -0000	1.87
@@ -196,8 +196,8 @@
     }
     log_fn(LOG_DEBUG,"success: handed off onionskin.");
   } else {
-    unsigned char keys[CPATH_KEY_MATERIAL_LEN];
-    unsigned char reply[DIGEST_LEN*2];
+    char keys[CPATH_KEY_MATERIAL_LEN];
+    char reply[DIGEST_LEN*2];
     tor_assert(cell->command == CELL_CREATE_FAST);
     if (fast_server_handshake(cell->payload, reply, keys, sizeof(keys))<0) {
       log_fn(LOG_WARN,"Failed to generate key material. Closing.");

Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection.c,v
retrieving revision 1.368
retrieving revision 1.369
diff -u -d -r1.368 -r1.369
--- connection.c	3 May 2005 10:04:07 -0000	1.368
+++ connection.c	7 May 2005 05:55:06 -0000	1.369
@@ -533,8 +533,8 @@
   /* information about the remote peer when connecting to other routers */
   struct sockaddr_in remote;
   char addrbuf[256];
-  /* length of the remote address. Must be an int, since accept() needs that. */
-  int remotelen = 256;
+  /* length of the remote address. Must be whatever accept() needs. */
+  socklen_t remotelen = 256;
   char tmpbuf[INET_NTOA_BUF_LEN];
   tor_assert((size_t)remotelen >= sizeof(struct sockaddr_in));
   memset(addrbuf, 0, sizeof(addrbuf));
@@ -1046,7 +1046,7 @@
 
   bytes_in_buf = buf_capacity(conn->inbuf) - buf_datalen(conn->inbuf);
  again:
-  if (at_most > bytes_in_buf && bytes_in_buf >= 1024) {
+  if ((size_t)at_most > bytes_in_buf && bytes_in_buf >= 1024) {
     more_to_read = at_most - bytes_in_buf;
     at_most = bytes_in_buf;
   } else {
@@ -1167,7 +1167,8 @@
  * return 0.
  */
 int connection_handle_write(connection_t *conn) {
-  int e, len=sizeof(e);
+  int e;
+  socklen_t len=sizeof(e);
   int result;
   time_t now = time(NULL);
 

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.323
retrieving revision 1.324
diff -u -d -r1.323 -r1.324
--- connection_edge.c	3 May 2005 10:17:38 -0000	1.323
+++ connection_edge.c	7 May 2005 05:55:06 -0000	1.324
@@ -258,7 +258,7 @@
  * any pending data that may have been received. */
 int connection_edge_finished_connecting(connection_t *conn)
 {
-  unsigned char connected_payload[4];
+  char connected_payload[4];
 
   tor_assert(conn);
   tor_assert(conn->type == CONN_TYPE_EXIT);
@@ -1474,7 +1474,7 @@
  */
 void
 connection_exit_connect(connection_t *conn) {
-  unsigned char connected_payload[4];
+  char connected_payload[4];
   uint32_t addr;
   uint16_t port;
 

Index: cpuworker.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/cpuworker.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- cpuworker.c	3 May 2005 03:51:19 -0000	1.78
+++ cpuworker.c	7 May 2005 05:55:06 -0000	1.79
@@ -117,7 +117,7 @@
  */
 int connection_cpu_process_inbuf(connection_t *conn) {
   char success;
-  unsigned char buf[LEN_ONION_RESPONSE];
+  char buf[LEN_ONION_RESPONSE];
   uint32_t addr;
   uint16_t port;
   uint16_t circ_id;
@@ -199,15 +199,15 @@
  * connections, not with routers (where we'd use identity).)
  */
 static int cpuworker_main(void *data) {
-  unsigned char question[ONIONSKIN_CHALLENGE_LEN];
-  unsigned char question_type;
+  char question[ONIONSKIN_CHALLENGE_LEN];
+  uint8_t question_type;
   int *fdarray = data;
   int fd;
 
   /* variables for onion processing */
-  unsigned char keys[CPATH_KEY_MATERIAL_LEN];
-  unsigned char reply_to_proxy[ONIONSKIN_REPLY_LEN];
-  unsigned char buf[LEN_ONION_RESPONSE];
+  char keys[CPATH_KEY_MATERIAL_LEN];
+  char reply_to_proxy[ONIONSKIN_REPLY_LEN];
+  char buf[LEN_ONION_RESPONSE];
   char tag[TAG_LEN];
   crypto_pk_env_t *onion_key = NULL, *last_onion_key = NULL;
 
@@ -390,7 +390,7 @@
  * If question_type is CPUWORKER_TASK_ONION then task is a circ.
  * No other question_types are allowed.
  */
-int assign_to_cpuworker(connection_t *cpuworker, unsigned char question_type,
+int assign_to_cpuworker(connection_t *cpuworker, uint8_t question_type,
                         void *task) {
   circuit_t *circ;
   char tag[TAG_LEN];
@@ -424,7 +424,7 @@
     cpuworker->state = CPUWORKER_STATE_BUSY_ONION;
     num_cpuworkers_busy++;
 
-    connection_write_to_buf(&question_type, 1, cpuworker);
+    connection_write_to_buf((char*)&question_type, 1, cpuworker);
     connection_write_to_buf(tag, sizeof(tag), cpuworker);
     connection_write_to_buf(circ->onionskin, ONIONSKIN_CHALLENGE_LEN, cpuworker);
   }

Index: dns.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/dns.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -d -r1.153 -r1.154
--- dns.c	3 May 2005 18:44:20 -0000	1.153
+++ dns.c	7 May 2005 05:55:06 -0000	1.154
@@ -330,7 +330,7 @@
   num_dnsworkers_busy++;
 
   len = strlen(dnsconn->address);
-  connection_write_to_buf(&len, 1, dnsconn);
+  connection_write_to_buf((char*)&len, 1, dnsconn);
   connection_write_to_buf(dnsconn->address, len, dnsconn);
 
   return 0;

Index: onion.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/onion.c,v
retrieving revision 1.178
retrieving revision 1.179
diff -u -d -r1.178 -r1.179
--- onion.c	2 May 2005 22:35:18 -0000	1.178
+++ onion.c	7 May 2005 05:55:06 -0000	1.179
@@ -347,7 +347,7 @@
   tmp[DIGEST_LEN+DIGEST_LEN] = 0;
   crypto_digest(handshake_reply_out+DIGEST_LEN, tmp, sizeof(tmp));
 
-  for (i = 0; i*DIGEST_LEN < key_out_len; ++i) {
+  for (i = 0; i*DIGEST_LEN < (int)key_out_len; ++i) {
     size_t len;
     tmp[DIGEST_LEN+DIGEST_LEN] = i+1;
     crypto_digest(digest, tmp, sizeof(tmp));
@@ -380,7 +380,7 @@
     return -1;
   }
 
-  for (i = 0; i*DIGEST_LEN < key_out_len; ++i) {
+  for (i = 0; i*DIGEST_LEN < (int)key_out_len; ++i) {
     size_t len;
     tmp[DIGEST_LEN+DIGEST_LEN] = i+1;
     crypto_digest(digest, tmp, sizeof(tmp));

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.605
retrieving revision 1.606
diff -u -d -r1.605 -r1.606
--- or.h	7 May 2005 04:49:09 -0000	1.605
+++ or.h	7 May 2005 05:55:06 -0000	1.606
@@ -521,9 +521,9 @@
  * OR-to-OR, is via cells. */
 typedef struct {
   uint16_t circ_id; /**< Circuit which received the cell. */
-  unsigned char command; /**< Type of the cell: one of PADDING, CREATE, RELAY,
-                          * or DESTROY. */
-  unsigned char payload[CELL_PAYLOAD_SIZE]; /**< Cell body. */
+  uint8_t command; /**< Type of the cell: one of PADDING, CREATE, RELAY,
+                    * or DESTROY. */
+  char payload[CELL_PAYLOAD_SIZE]; /**< Cell body. */
 } cell_t;
 
 /** Beginning of a RELAY cell payload. */
@@ -1166,7 +1166,7 @@
 int circuit_init_cpath_crypto(crypt_path_t *cpath, char *key_data, int reverse);
 int circuit_finish_handshake(circuit_t *circ, uint8_t cell_type, char *reply);
 int circuit_truncated(circuit_t *circ, crypt_path_t *layer);
-int onionskin_answer(circuit_t *circ, uint8_t cell_type, unsigned char *payload, unsigned char *keys);
+int onionskin_answer(circuit_t *circ, uint8_t cell_type, char *payload, char *keys);
 int circuit_all_predicted_ports_handled(time_t now, int *need_uptime,
                                         int *need_capacity);
 
@@ -1445,7 +1445,7 @@
 int connection_cpu_finished_flushing(connection_t *conn);
 int connection_cpu_reached_eof(connection_t *conn);
 int connection_cpu_process_inbuf(connection_t *conn);
-int assign_to_cpuworker(connection_t *cpuworker, unsigned char question_type,
+int assign_to_cpuworker(connection_t *cpuworker, uint8_t question_type,
                         void *task);
 
 /********************************* directory.c ***************************/

Index: routerparse.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/routerparse.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- routerparse.c	2 May 2005 21:48:25 -0000	1.108
+++ routerparse.c	7 May 2005 05:55:06 -0000	1.109
@@ -930,7 +930,7 @@
   }
   if (crypto_pk_keysize(tok->key) != PK_BYTES) {
     log_fn(LOG_WARN, "Wrong size on onion key: %d bits!",
-           crypto_pk_keysize(tok->key)*8);
+           (int)crypto_pk_keysize(tok->key)*8);
     goto err;
   }
   router->onion_pkey = tok->key;
@@ -941,7 +941,7 @@
   }
   if (crypto_pk_keysize(tok->key) != PK_BYTES) {
     log_fn(LOG_WARN, "Wrong size on identity key: %d bits!",
-           crypto_pk_keysize(tok->key)*8);
+           (int)crypto_pk_keysize(tok->key)*8);
     goto err;
   }
   router->identity_pkey = tok->key;