aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-10-14 03:18:14 +0000
committerNick Mathewson <nickm@torproject.org>2004-10-14 03:18:14 +0000
commit1c9426d6e027d4a7789471691ad1703b05f60fad (patch)
tree0892be29c16011091754cb7fbfe1275bc172a42b
parent3737566465f11bf2bd710239e38634590c4c4603 (diff)
downloadtor-1c9426d6e027d4a7789471691ad1703b05f60fad.tar
tor-1c9426d6e027d4a7789471691ad1703b05f60fad.tar.gz
Build without warnings on mac gcc 3.3
svn:r2487
-rw-r--r--src/common/tortls.c2
-rw-r--r--src/or/buffers.c19
-rw-r--r--src/or/connection.c2
-rw-r--r--src/or/directory.c10
-rw-r--r--src/or/main.c2
-rw-r--r--src/or/relay.c6
-rw-r--r--src/or/rendclient.c2
-rw-r--r--src/or/rendcommon.c2
-rw-r--r--src/or/rendmid.c2
-rw-r--r--src/or/rendservice.c2
-rw-r--r--src/or/router.c7
11 files changed, 26 insertions, 30 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c
index 8a4dccaa2..306d9f55e 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -465,7 +465,7 @@ tor_tls_write(tor_tls *tls, char *cp, size_t n)
/* if WANTWRITE last time, we must use the _same_ n as before */
tor_assert(n >= tls->wantwrite_n);
log_fn(LOG_DEBUG,"resuming pending-write, (%d to flush, reusing %d)",
- n, tls->wantwrite_n);
+ (int)n, (int)tls->wantwrite_n);
n = tls->wantwrite_n;
tls->wantwrite_n = 0;
}
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 1d37d17a5..26c1e568a 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -258,7 +258,7 @@ int flush_buf(int s, buf_t *buf, size_t *buf_flushlen)
*buf_flushlen -= write_result;
buf_remove_from_front(buf, write_result);
log_fn(LOG_DEBUG,"%d: flushed %d bytes, %d ready to flush, %d remain.",
- s,write_result,*buf_flushlen,(int)buf->datalen);
+ s,write_result,(int)*buf_flushlen,(int)buf->datalen);
return write_result;
}
@@ -281,7 +281,7 @@ int flush_buf_tls(tor_tls *tls, buf_t *buf, size_t *buf_flushlen)
*buf_flushlen -= r;
buf_remove_from_front(buf, r);
log_fn(LOG_DEBUG,"flushed %d bytes, %d ready to flush, %d remain.",
- r,*buf_flushlen,(int)buf->datalen);
+ r,(int)*buf_flushlen,(int)buf->datalen);
return r;
}
@@ -300,13 +300,13 @@ int write_to_buf(const char *string, size_t string_len, buf_t *buf) {
assert_buf_ok(buf);
if (buf_ensure_capacity(buf, buf->datalen+string_len)) {
- log_fn(LOG_WARN, "buflen too small, can't hold %d bytes.", (int)buf->datalen+string_len);
+ log_fn(LOG_WARN, "buflen too small, can't hold %d bytes.", (int)(buf->datalen+string_len));
return -1;
}
memcpy(buf->mem+buf->datalen, string, string_len);
buf->datalen += string_len;
- log_fn(LOG_DEBUG,"added %d bytes to buf (now %d total).",string_len, (int)buf->datalen);
+ log_fn(LOG_DEBUG,"added %d bytes to buf (now %d total).",(int)string_len, (int)buf->datalen);
return buf->datalen;
}
@@ -368,14 +368,15 @@ int fetch_from_buf_http(buf_t *buf,
body += 4; /* Skip the the CRLFCRLF */
headerlen = body-headers; /* includes the CRLFCRLF */
bodylen = buf->datalen - headerlen;
- log_fn(LOG_DEBUG,"headerlen %d, bodylen %d.", headerlen, bodylen);
+ log_fn(LOG_DEBUG,"headerlen %d, bodylen %d.", (int)headerlen, (int)bodylen);
if(max_headerlen <= headerlen) {
- log_fn(LOG_WARN,"headerlen %d larger than %d. Failing.", headerlen, max_headerlen-1);
+ log_fn(LOG_WARN,"headerlen %d larger than %d. Failing.", (int)headerlen,
+ (int)max_headerlen-1);
return -1;
}
if(max_bodylen <= bodylen) {
- log_fn(LOG_WARN,"bodylen %d larger than %d. Failing.", bodylen, max_bodylen-1);
+ log_fn(LOG_WARN,"bodylen %d larger than %d. Failing.", (int)bodylen, (int)max_bodylen-1);
return -1;
}
@@ -390,14 +391,14 @@ int fetch_from_buf_http(buf_t *buf,
}
contentlen = i;
/* if content-length is malformed, then our body length is 0. fine. */
- log_fn(LOG_DEBUG,"Got a contentlen of %d.",contentlen);
+ log_fn(LOG_DEBUG,"Got a contentlen of %d.",(int)contentlen);
if(bodylen < contentlen) {
log_fn(LOG_DEBUG,"body not all here yet.");
return 0; /* not all there yet */
}
if(bodylen > contentlen) {
bodylen = contentlen;
- log_fn(LOG_DEBUG,"bodylen reduced to %d.",bodylen);
+ log_fn(LOG_DEBUG,"bodylen reduced to %d.",(int)bodylen);
}
}
/* all happy. copy into the appropriate places, and return 1 */
diff --git a/src/or/connection.c b/src/or/connection.c
index cf94213f0..090922b0a 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -236,7 +236,7 @@ void connection_close_immediate(connection_t *conn)
if (conn->outbuf_flushlen) {
log_fn(LOG_INFO,"fd %d, type %s, state %d, %d bytes on outbuf.",
conn->s, CONN_TYPE_TO_STRING(conn->type),
- conn->state, conn->outbuf_flushlen);
+ conn->state, (int)conn->outbuf_flushlen);
}
tor_close_socket(conn->s);
conn->s = -1;
diff --git a/src/or/directory.c b/src/or/directory.c
index 5fefc7c22..ad3333035 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -326,11 +326,11 @@ directory_send_command(connection_t *conn, const char *platform,
break;
}
- snprintf(tmp, sizeof(tmp), "%s %s%s HTTP/1.0\r\nContent-Length: %d\r\nHost: %s\r\n\r\n",
+ snprintf(tmp, sizeof(tmp), "%s %s%s HTTP/1.0\r\nContent-Length: %lu\r\nHost: %s\r\n\r\n",
httpcommand,
proxystring,
url,
- payload_len,
+ (unsigned long)payload_len,
hoststring);
connection_write_to_buf(tmp, strlen(tmp), conn);
@@ -517,7 +517,7 @@ connection_dir_client_reached_eof(connection_t *conn)
if(conn->purpose == DIR_PURPOSE_FETCH_DIR) {
/* fetch/process the directory to learn about new routers. */
- log_fn(LOG_INFO,"Received directory (size %d):\n%s", body_len, body);
+ log_fn(LOG_INFO,"Received directory (size %d):\n%s", (int)body_len, body);
if(status_code == 503 || body_len == 0) {
log_fn(LOG_INFO,"Empty directory. Ignoring.");
tor_free(body); tor_free(headers);
@@ -541,7 +541,7 @@ connection_dir_client_reached_eof(connection_t *conn)
running_routers_t *rrs;
routerlist_t *rl;
/* just update our list of running routers, if this list is new info */
- log_fn(LOG_INFO,"Received running-routers list (size %d):\n%s", body_len, body);
+ log_fn(LOG_INFO,"Received running-routers list (size %d):\n%s", (int)body_len, body);
if(status_code != 200) {
log_fn(LOG_WARN,"Received http status code %d from dirserver. Failing.",
status_code);
@@ -577,7 +577,7 @@ connection_dir_client_reached_eof(connection_t *conn)
if(conn->purpose == DIR_PURPOSE_FETCH_RENDDESC) {
log_fn(LOG_INFO,"Received rendezvous descriptor (size %d, status code %d)",
- body_len, status_code);
+ (int)body_len, status_code);
switch(status_code) {
case 200:
if(rend_cache_store(body, body_len) < 0) {
diff --git a/src/or/main.c b/src/or/main.c
index e16e72b89..13c53d60b 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -313,7 +313,7 @@ static void conn_close_if_marked(int i) {
"Conn (addr %s, fd %d, type %s, state %d) marked, but wants to flush %d bytes. "
"(Marked at %s:%d)",
conn->address, conn->s, CONN_TYPE_TO_STRING(conn->type), conn->state,
- conn->outbuf_flushlen, conn->marked_for_close_file, conn->marked_for_close);
+ (int)conn->outbuf_flushlen, conn->marked_for_close_file, conn->marked_for_close);
if(connection_speaks_cells(conn)) {
if(conn->state == OR_CONN_STATE_OPEN) {
retval = flush_buf_tls(conn->tls, conn->outbuf, &conn->outbuf_flushlen);
diff --git a/src/or/relay.c b/src/or/relay.c
index 082f28f3f..3c353b71d 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -892,8 +892,8 @@ repeat_connection_edge_package_raw_inbuf:
connection_fetch_from_buf(payload, length, conn);
- log_fn(LOG_DEBUG,"(%d) Packaging %d bytes (%d waiting).", conn->s, length,
- (int)buf_datalen(conn->inbuf));
+ log_fn(LOG_DEBUG,"(%d) Packaging %d bytes (%d waiting).", conn->s,
+ (int)length, (int)buf_datalen(conn->inbuf));
if(connection_edge_send_command(conn, circ, RELAY_COMMAND_DATA,
payload, length, conn->cpath_layer) < 0)
@@ -940,7 +940,7 @@ void connection_edge_consider_sending_sendme(connection_t *conn) {
}
while(conn->deliver_window < STREAMWINDOW_START - STREAMWINDOW_INCREMENT) {
- log_fn(LOG_DEBUG,"Outbuf %d, Queueing stream sendme.", conn->outbuf_flushlen);
+ log_fn(LOG_DEBUG,"Outbuf %d, Queueing stream sendme.", (int)conn->outbuf_flushlen);
conn->deliver_window += STREAMWINDOW_INCREMENT;
if(connection_edge_send_command(conn, circ, RELAY_COMMAND_SENDME,
NULL, 0, conn->cpath_layer) < 0) {
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
index 877617354..70f0564a5 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
@@ -310,7 +310,7 @@ rend_client_receive_rendezvous(circuit_t *circ, const char *request, size_t requ
}
if (request_len != DH_KEY_LEN+DIGEST_LEN) {
- log_fn(LOG_WARN,"Incorrect length (%d) on RENDEZVOUS2 cell.",request_len);
+ log_fn(LOG_WARN,"Incorrect length (%d) on RENDEZVOUS2 cell.",(int)request_len);
goto err;
}
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
index 708e113b1..6ee99bc66 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
@@ -297,7 +297,7 @@ int rend_cache_store(const char *desc, size_t desc_len)
e->desc = tor_malloc(desc_len);
memcpy(e->desc, desc, desc_len);
- log_fn(LOG_INFO,"Successfully stored rend desc '%s', len %d", query, desc_len);
+ log_fn(LOG_INFO,"Successfully stored rend desc '%s', len %d", query, (int)desc_len);
return 0;
}
diff --git a/src/or/rendmid.c b/src/or/rendmid.c
index b180914ae..a64b84434 100644
--- a/src/or/rendmid.c
+++ b/src/or/rendmid.c
@@ -246,7 +246,7 @@ rend_mid_rendezvous(circuit_t *circ, const char *request, size_t request_len)
if (request_len != REND_COOKIE_LEN+DH_KEY_LEN+DIGEST_LEN) {
log_fn(LOG_WARN,
"Rejecting RENDEZVOUS1 cell with bad length (%d) on circuit %d",
- request_len, circ->p_circ_id);
+ (int)request_len, circ->p_circ_id);
goto err;
}
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
index 7ff249102..2c86b4385 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
@@ -422,7 +422,7 @@ rend_service_introduce(circuit_t *circuit, const char *request, size_t request_l
ptr = rp_nickname+nickname_field_len;
len -= nickname_field_len;
if (len != REND_COOKIE_LEN+DH_KEY_LEN) {
- log_fn(LOG_WARN, "Bad length %u for INTRODUCE2 cell.", len);
+ log_fn(LOG_WARN, "Bad length %u for INTRODUCE2 cell.", (int)len);
return -1;
}
r_cookie = ptr;
diff --git a/src/or/router.c b/src/or/router.c
index 7f07047a0..cf018efb0 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -349,12 +349,7 @@ int init_keys(void) {
/* 6b. [authdirserver only] add own key to approved directories. */
crypto_pk_get_digest(get_identity_key(), digest);
if (!router_digest_is_trusted_dir(digest)) {
- uint32_t addr;
- if(resolve_my_address(options.Address, &addr) < 0) {
- log_fn(LOG_WARN,"options.Address didn't resolve into an IP.");
- return -1;
- }
- add_trusted_dir_server(addr, options.DirPort, digest);
+ add_trusted_dir_server(options.Address, options.DirPort, digest);
}
/* 7. [authdirserver only] load old directory, if it's there */
sprintf(keydir,"%s/cached-directory", datadir);