aboutsummaryrefslogtreecommitdiff
path: root/src/common/torgzip.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-06-25 18:56:15 -0400
committerNick Mathewson <nickm@torproject.org>2010-06-25 18:56:15 -0400
commitfaad8bd0e80807d47aa985599e737256105f2a44 (patch)
treebd6940e77b83e6ba623ef4cbd610b19bb6ea57e7 /src/common/torgzip.c
parent0d5ff48b922762752c8b92f587dc83806f95fb9f (diff)
parent1a52e39c22d522a8c4a23615f90b7f4560c2a9a2 (diff)
downloadtor-faad8bd0e80807d47aa985599e737256105f2a44.tar
tor-faad8bd0e80807d47aa985599e737256105f2a44.tar.gz
Merge branch 'bug1526-v2'
Diffstat (limited to 'src/common/torgzip.c')
-rw-r--r--src/common/torgzip.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/common/torgzip.c b/src/common/torgzip.c
index 27d9c42ef..9ebddf07b 100644
--- a/src/common/torgzip.c
+++ b/src/common/torgzip.c
@@ -13,20 +13,42 @@
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
-#ifdef _MSC_VER
-#include "..\..\contrib\zlib\zlib.h"
-#else
-#include <zlib.h>
-#endif
#include <string.h>
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
+#include "torint.h"
#include "util.h"
#include "log.h"
#include "torgzip.h"
+/* zlib 1.2.4 and 1.2.5 do some "clever" things with macros. Instead of
+ saying "(defined(FOO) ? FOO : 0)" they like to say "FOO-0", on the theory
+ that nobody will care if the compile outputs a no-such-identifier warning.
+
+ Sorry, but we like -Werror over here, so I guess we need to define these.
+ I hope that zlib 1.2.6 doesn't break these too.
+*/
+#ifndef _LARGEFILE64_SOURCE
+#define _LARGEFILE64_SOURCE 0
+#endif
+#ifndef _LFS64_LARGEFILE
+#define _LFS64_LARGEFILE 0
+#endif
+#ifndef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 0
+#endif
+#ifndef off64_t
+#define off64_t int64_t
+#endif
+
+#ifdef _MSC_VER
+#include "..\..\contrib\zlib\zlib.h"
+#else
+#include <zlib.h>
+#endif
+
/** Set to 1 if zlib is a version that supports gzip; set to 0 if it doesn't;
* set to -1 if we haven't checked yet. */
static int gzip_is_supported = -1;