[or-cvs] Build without warnings on mac gcc 3.3

Nick Mathewson nickm at seul.org
Thu Oct 14 03:18:18 UTC 2004


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

Modified Files:
	buffers.c connection.c directory.c main.c relay.c rendclient.c 
	rendcommon.c rendmid.c rendservice.c router.c 
Log Message:
Build without warnings on mac gcc 3.3

Index: buffers.c
===================================================================
RCS file: /home/or/cvsroot/src/or/buffers.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -d -r1.106 -r1.107
--- buffers.c	14 Oct 2004 02:47:08 -0000	1.106
+++ buffers.c	14 Oct 2004 03:18:14 -0000	1.107
@@ -258,7 +258,7 @@
     *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 @@
   *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 @@
   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 @@
   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 @@
     }
     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 */

Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.260
retrieving revision 1.261
diff -u -d -r1.260 -r1.261
--- connection.c	14 Oct 2004 02:47:08 -0000	1.260
+++ connection.c	14 Oct 2004 03:18:14 -0000	1.261
@@ -236,7 +236,7 @@
   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;

Index: directory.c
===================================================================
RCS file: /home/or/cvsroot/src/or/directory.c,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -d -r1.142 -r1.143
--- directory.c	14 Oct 2004 02:47:08 -0000	1.142
+++ directory.c	14 Oct 2004 03:18:14 -0000	1.143
@@ -326,11 +326,11 @@
       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 @@
 
   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 @@
     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 @@
 
   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) {

Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.332
retrieving revision 1.333
diff -u -d -r1.332 -r1.333
--- main.c	7 Oct 2004 20:15:56 -0000	1.332
+++ main.c	14 Oct 2004 03:18:14 -0000	1.333
@@ -313,7 +313,7 @@
         "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);

Index: relay.c
===================================================================
RCS file: /home/or/cvsroot/src/or/relay.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- relay.c	14 Oct 2004 02:47:09 -0000	1.12
+++ relay.c	14 Oct 2004 03:18:14 -0000	1.13
@@ -892,8 +892,8 @@
 
   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 @@
   }
 
   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) {

Index: rendclient.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendclient.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- rendclient.c	14 Oct 2004 02:47:09 -0000	1.55
+++ rendclient.c	14 Oct 2004 03:18:14 -0000	1.56
@@ -310,7 +310,7 @@
   }
 
   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;
   }
 

Index: rendcommon.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendcommon.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- rendcommon.c	14 Oct 2004 02:47:09 -0000	1.35
+++ rendcommon.c	14 Oct 2004 03:18:14 -0000	1.36
@@ -297,7 +297,7 @@
   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;
 }
 

Index: rendmid.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendmid.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- rendmid.c	14 Oct 2004 02:47:09 -0000	1.26
+++ rendmid.c	14 Oct 2004 03:18:14 -0000	1.27
@@ -246,7 +246,7 @@
   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;
   }
 

Index: rendservice.c
===================================================================
RCS file: /home/or/cvsroot/src/or/rendservice.c,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -d -r1.88 -r1.89
--- rendservice.c	14 Oct 2004 02:47:09 -0000	1.88
+++ rendservice.c	14 Oct 2004 03:18:14 -0000	1.89
@@ -422,7 +422,7 @@
   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;

Index: router.c
===================================================================
RCS file: /home/or/cvsroot/src/or/router.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- router.c	14 Oct 2004 02:47:09 -0000	1.94
+++ router.c	14 Oct 2004 03:18:14 -0000	1.95
@@ -349,12 +349,7 @@
   /* 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);



More information about the tor-commits mailing list