]> granicus.if.org Git - libevent/commitdiff
Fix a compile warning with zlib 1.2.4 and 1.2.5
authorSebastian Hahn <sebastian@torproject.org>
Thu, 5 May 2011 16:02:42 +0000 (18:02 +0200)
committerNick Mathewson <nickm@torproject.org>
Fri, 6 May 2011 14:58:06 +0000 (10:58 -0400)
I took this fix from Tor (commit 1a52e39c22d5, author Nick Mathewson,
Copyright (c) 2007-2011, The Tor Project, Inc.) and adapted it slightly
for libevent.

test/regress_zlib.c

index 12ddcca9f61c40da41b0bfa0577af0768f6c2211..6dd7bf8f611e0feb60e1142f39987b47cf78c73b 100644 (file)
@@ -46,7 +46,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <zlib.h>
 #include <assert.h>
 #include <errno.h>
 
 
 #include "regress.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 ev_int64_t
+#endif
+
+#include <zlib.h>
+
 static int infilter_calls;
 static int outfilter_calls;
 static int readcb_finished;