Commit 1c9426d6 authored by Nick Mathewson's avatar Nick Mathewson 🤹
Browse files

Build without warnings on mac gcc 3.3


svn:r2487
parent 37375664
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
  }
+10 −9
Original line number Diff line number Diff line
@@ -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 */
+1 −1
Original line number Diff line number Diff line
@@ -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;
+5 −5
Original line number Diff line number Diff line
@@ -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) {
+1 −1
Original line number Diff line number Diff line
@@ -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);
Loading