[tor-commits] [stegotorus/master] fixing compiler errors when on 32-bit machine and explicit casts for log messages are needed

zwol at torproject.org zwol at torproject.org
Fri Jul 20 23:17:08 UTC 2012


commit a0b21894457ef2ea4a3f98d7a1bd4a54861f2967
Author: Linda Briesemeister <linda.briesemeister at sri.com>
Date:   Mon Jun 11 12:29:34 2012 -0500

    fixing compiler errors when on 32-bit machine and explicit casts for log messages are needed
---
 src/protocol/null.cc |    4 ++--
 src/steg/embed.cc    |    8 ++++----
 src/steg/http.cc     |    2 +-
 src/steg/pdfSteg.cc  |    2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/protocol/null.cc b/src/protocol/null.cc
index d8fe98b..c5ec831 100644
--- a/src/protocol/null.cc
+++ b/src/protocol/null.cc
@@ -196,7 +196,7 @@ int
 null_circuit_t::send()
 {
   log_debug(this, "sending %lu bytes",
-            evbuffer_get_length(bufferevent_get_input(this->up_buffer)));
+            (unsigned long)evbuffer_get_length(bufferevent_get_input(this->up_buffer)));
 
   return evbuffer_add_buffer(this->downstream->outbound(),
                              bufferevent_get_input(this->up_buffer));
@@ -268,7 +268,7 @@ int
 null_conn_t::recv()
 {
   log_assert(this->upstream);
-  log_debug(this, "receiving %lu bytes", evbuffer_get_length(this->inbound()));
+  log_debug(this, "receiving %lu bytes", (unsigned long)evbuffer_get_length(this->inbound()));
   return evbuffer_add_buffer(bufferevent_get_output(this->upstream->up_buffer),
                              this->inbound());
 }
diff --git a/src/steg/embed.cc b/src/steg/embed.cc
index 327c7c4..463148d 100644
--- a/src/steg/embed.cc
+++ b/src/steg/embed.cc
@@ -82,15 +82,15 @@ embed_steg_config_t::embed_steg_config_t(config_t *cfg)
   for (vector<trace_t>::iterator p = traces.begin(); p != traces.end(); ++p) {
     int num_pkt;
     if (fscanf(trace_file, "%d", &num_pkt) < 1)
-      log_abort("couldn't read number of packets in trace %ld",
-                p - traces.begin());
+      log_abort("couldn't read number of packets in trace %li",
+                (long)(p - traces.begin()));
 
     p->pkt_sizes.resize(num_pkt);
     p->pkt_times.resize(num_pkt);
     for (int i = 0; i < num_pkt; i++)
       if (fscanf(trace_file, "%hd %d", &p->pkt_sizes[i], &p->pkt_times[i]) < 1)
-        log_abort("couldn't read trace entry %ld/%d",
-                  p - traces.begin(), i);
+        log_abort("couldn't read trace entry %li/%d",
+                  (long)(p - traces.begin()), i);
   }
 
   log_debug("read %d traces", num_traces);
diff --git a/src/steg/http.cc b/src/steg/http.cc
index cfeaf93..171bdcb 100644
--- a/src/steg/http.cc
+++ b/src/steg/http.cc
@@ -329,7 +329,7 @@ http_client_cookie_transmit (http_steg_t *s, struct evbuffer *source,
     return -1;
   }
   log_debug(conn, "cookie input %ld encoded %d final %d",
-            sbuflen, len, cookie_len);
+            (long)sbuflen, len, cookie_len);
   log_debug(conn, "cookie encoded: %s", data2);
   log_debug(conn, "cookie final: %s", cookiebuf);
 
diff --git a/src/steg/pdfSteg.cc b/src/steg/pdfSteg.cc
index 2f67051..f76da99 100644
--- a/src/steg/pdfSteg.cc
+++ b/src/steg/pdfSteg.cc
@@ -224,7 +224,7 @@ pdf_wrap(const char *data, size_t dlen,
   data2len = compress((const uint8_t *)data, dlen, 
                       (uint8_t *)data2, data2size, c_format_zlib);
   if ((int)data2len < 0) {
-    log_warn("compress failed and returned %lu", data2len);
+    log_warn("compress failed and returned %lu", (unsigned long)data2len);
     return -1;
   }
 





More information about the tor-commits mailing list