]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix minGW compatibility issue with zu format specifier.
authorFernando Fernandez Mancera <ffernandezmancera@gmail.com>
Fri, 12 Jan 2018 16:44:30 +0000 (17:44 +0100)
committerFernando Fernandez Mancera <ffernandezmancera@gmail.com>
Fri, 12 Jan 2018 16:44:30 +0000 (17:44 +0100)
Define TOR_PRIuSZ as minGW compiler doesn't support zu format specifier for
size_t type.

Fixes #24861 on ac9eebd.

Signed-off-by: Fernando Fernandez Mancera <ffernandezmancera@gmail.com>
changes/ticket24861 [new file with mode: 0644]
src/common/torint.h
src/or/circuitlist.c

diff --git a/changes/ticket24861 b/changes/ticket24861
new file mode 100644 (file)
index 0000000..beddb77
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfix (zu format specifier on minGW):
+    - Fix minGW compatibility issue. Define TOR_PRIuSZ as minGW compiler
+      doesn't support zu format specifier for size_t type. Fixes bug 24861;
+      bugfix on ac9eebd6363.
+      Patch by "ffmancera".
index bc81c114f841da922361b35fd3eab17611d25502..0b8061d24fb169024f99b4a83b4d32eac392352c 100644 (file)
@@ -348,6 +348,16 @@ typedef uint32_t uintptr_t;
 #endif /* (SIZEOF_SIZE_T == 4) || ... */
 #endif /* !defined(SIZE_MAX) */
 
+#ifdef _WIN32
+#  ifdef _WIN64
+#    define TOR_PRIuSZ PRIu64
+#  else
+#    define TOR_PRIuSZ PRIu32
+#  endif
+#else
+#  define TOR_PRIuSZ "zu"
+#endif
+
 #ifndef SSIZE_MAX
 #if (SIZEOF_SIZE_T == 4)
 #define SSIZE_MAX INT32_MAX
index 661438d8f1b8e6f08364d26448cb3f4e930a8d12..028fdbfc2ff0e409df93feb528eb309af7f29343 100644 (file)
@@ -51,6 +51,8 @@
  * logic, which was originally circuit-focused.
  **/
 #define CIRCUITLIST_PRIVATE
+#include "torint.h"  /* TOR_PRIuSZ */
+
 #include "or.h"
 #include "channel.h"
 #include "circpathbias.h"
@@ -2404,10 +2406,11 @@ circuits_handle_oom(size_t current_allocation)
   int n_circuits_killed=0;
   int n_dirconns_killed=0;
   uint32_t now_ts;
-  log_notice(LD_GENERAL, "We're low on memory (cell queues total alloc: %zu,"
-             " buffer total alloc: %zu, tor compress total alloc: %zu,"
-             " rendezvous cache total alloc: %zu). Killing circuits with"
-             " over-long queues. (This behavior is controlled by"
+  log_notice(LD_GENERAL, "We're low on memory (cell queues total alloc:"
+             " %"TOR_PRIuSZ" buffer total alloc: %" TOR_PRIuSZ ","
+             " tor compress total alloc: %" TOR_PRIuSZ
+             " rendezvous cache total alloc: %" TOR_PRIuSZ "). Killing"
+             " circuits withover-long queues. (This behavior is controlled by"
              " MaxMemInQueues.)",
              cell_queues_get_total_allocation(),
              buf_get_total_allocation(),