Build without warnings on mac gcc 3.3

svn:r2487
This commit is contained in:
Nick Mathewson 2004-10-14 03:18:14 +00:00
parent 3737566465
commit 1c9426d6e0
11 changed files with 26 additions and 30 deletions

View File

@ -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;
}

View File

@ -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 */

View File

@ -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;

View File

@ -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) {

View File

@ -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);

View File

@ -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) {

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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);