aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2011-10-26 07:39:01 -0400
committerRoger Dingledine <arma@torproject.org>2011-10-26 07:39:01 -0400
commit7c29b6996ee315cf2d8fdd6fe53b47512174be77 (patch)
tree50153409e9f19fe9c2e36a79d56d34fbb3897364
parentc55f586e3684bd864ec44285264a208102119c65 (diff)
parentc5a3664f27379f5f6cc9a2b92032d50ab34550f8 (diff)
downloadtor-7c29b6996ee315cf2d8fdd6fe53b47512174be77.tar.gz
tor-7c29b6996ee315cf2d8fdd6fe53b47512174be77.zip
Merge branch 'maint-0.2.1' into release-0.2.1
-rw-r--r--changes/bug15263
-rw-r--r--src/common/torgzip.c32
2 files changed, 30 insertions, 5 deletions
diff --git a/changes/bug1526 b/changes/bug1526
new file mode 100644
index 0000000000..bae7104451
--- /dev/null
+++ b/changes/bug1526
@@ -0,0 +1,3 @@
+ o Minor bugfixes:
+ - Build correctly on OSX with zlib 1.2.4 and higher with all warnings
+ enabled. \ No newline at end of file
diff --git a/src/common/torgzip.c b/src/common/torgzip.c
index f5709aaf3c..95d5797c45 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;