diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-05-07 05:55:06 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-05-07 05:55:06 +0000 |
commit | 10b2208d9386972b76f10c2557562b5912dd130e (patch) | |
tree | 007a393aff385b1cbe47ffdc4d377edb5dac9898 /src/or | |
parent | 6567ec9ccf108ac2b51da77fff5e00b722640765 (diff) | |
download | tor-10b2208d9386972b76f10c2557562b5912dd130e.tar.gz tor-10b2208d9386972b76f10c2557562b5912dd130e.zip |
Make Tor compile with no warnings with gcc4.0 on OSX
svn:r4184
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/circuitbuild.c | 4 | ||||
-rw-r--r-- | src/or/command.c | 4 | ||||
-rw-r--r-- | src/or/connection.c | 9 | ||||
-rw-r--r-- | src/or/connection_edge.c | 4 | ||||
-rw-r--r-- | src/or/cpuworker.c | 16 | ||||
-rw-r--r-- | src/or/dns.c | 2 | ||||
-rw-r--r-- | src/or/onion.c | 4 | ||||
-rw-r--r-- | src/or/or.h | 10 | ||||
-rw-r--r-- | src/or/routerparse.c | 4 |
9 files changed, 29 insertions, 28 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index f2257690dc..ba342d433a 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -676,7 +676,7 @@ int circuit_init_cpath_crypto(crypt_path_t *cpath, char *key_data, int reverse) * 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 @@ int circuit_truncated(circuit_t *circ, crypt_path_t *layer) { /** 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; diff --git a/src/or/command.c b/src/or/command.c index fe476d4af3..fc000e955a 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -196,8 +196,8 @@ static void command_process_create_cell(cell_t *cell, connection_t *conn) { } 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."); diff --git a/src/or/connection.c b/src/or/connection.c index 41a2ce38b6..3581e51620 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -533,8 +533,8 @@ static int connection_handle_listener_read(connection_t *conn, int new_type) { /* 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 @@ static int connection_read_to_buf(connection_t *conn, int *max_to_read) { 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 @@ int connection_outbuf_too_full(connection_t *conn) { * 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); diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index bb2bb02e2e..451584cd3e 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -258,7 +258,7 @@ int connection_edge_finished_flushing(connection_t *conn) { * 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 @@ int connection_exit_begin_resolve(cell_t *cell, circuit_t *circ) { */ void connection_exit_connect(connection_t *conn) { - unsigned char connected_payload[4]; + char connected_payload[4]; uint32_t addr; uint16_t port; diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c index 1f4f4aec1d..2da8b99748 100644 --- a/src/or/cpuworker.c +++ b/src/or/cpuworker.c @@ -117,7 +117,7 @@ int connection_cpu_reached_eof(connection_t *conn) { */ 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 @@ done_processing: * 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 @@ cull_wedged_cpuworkers(void) { * 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 @@ int assign_to_cpuworker(connection_t *cpuworker, unsigned char question_type, 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); } diff --git a/src/or/dns.c b/src/or/dns.c index 3ed03a2d8f..d2bb017631 100644 --- a/src/or/dns.c +++ b/src/or/dns.c @@ -330,7 +330,7 @@ static int assign_to_dnsworker(connection_t *exitconn) { 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; diff --git a/src/or/onion.c b/src/or/onion.c index c24612957f..d51000198b 100644 --- a/src/or/onion.c +++ b/src/or/onion.c @@ -347,7 +347,7 @@ fast_server_handshake(const char *key_in, /* DIGEST_LEN bytes */ 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 @@ fast_client_handshake(const char *handshake_state, /* DIGEST_LEN bytes */ 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)); diff --git a/src/or/or.h b/src/or/or.h index 62f73987ba..146897a38d 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -521,9 +521,9 @@ typedef enum { * 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_extend(cell_t *cell, circuit_t *circ); 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 @@ void cpuworkers_rotate(void); 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 ***************************/ diff --git a/src/or/routerparse.c b/src/or/routerparse.c index d68ff087ab..87e2a06980 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -930,7 +930,7 @@ routerinfo_t *router_parse_entry_from_string(const char *s, } 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 @@ routerinfo_t *router_parse_entry_from_string(const char *s, } 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; |