summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-02-25 16:22:40 -0500
committerNick Mathewson <nickm@torproject.org>2010-02-25 16:22:40 -0500
commiteb10d441b63c763c362dbb186b355747501e5424 (patch)
tree1d7bd2886d883767bda13b5a376853f59686a263 /src/common
parent2ab3389ed64827fee4e756e5a3ffc5ff579b1a05 (diff)
downloadtor-eb10d441b63c763c362dbb186b355747501e5424.tar.gz
tor-eb10d441b63c763c362dbb186b355747501e5424.zip
Fix 64-bit printf issues in consensus-bw-weights5-merge.
For my 64-bit Linux system running with GCC 4.4.3-fc12-whatever, you can't do 'printf("%lld", (int64_t)x);' Instead you need to tell the compiler 'printf("%lld", (long long int)x);' or else it doesn't believe the types match. This is why we added U64_PRINTF_ARG; it looks like we needed an I64_PRINTF_ARG too.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/compat.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/compat.h b/src/common/compat.h
index 60fb1cb652..3b58bff8c4 100644
--- a/src/common/compat.h
+++ b/src/common/compat.h
@@ -196,10 +196,16 @@ size_t strlcpy(char *dst, const char *src, size_t siz) ATTR_NONNULL((1,2));
#define U64_SCANF_ARG(a) (a)
/** Expands to a literal uint64_t-typed constant for the value <b>n</b>. */
#define U64_LITERAL(n) (n ## ui64)
+#define I64_PRINTF_ARG(a) (a)
+#define I64_SCANF_ARG(a) (a)
+#define I64_LITERAL(n) (n ## i64)
#else
#define U64_PRINTF_ARG(a) ((long long unsigned int)(a))
#define U64_SCANF_ARG(a) ((long long unsigned int*)(a))
#define U64_LITERAL(n) (n ## llu)
+#define I64_PRINTF_ARG(a) ((long long signed int)(a))
+#define I64_SCANF_ARG(a) ((long long signed int*)(a))
+#define I64_LITERAL(n) (n ## ll)
#endif
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)