summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2010-03-19 00:51:48 +0000
committerdelphij <delphij@FreeBSD.org>2010-03-19 00:51:48 +0000
commit4171b4e2c265add16cb3cc5fd92155377eda6460 (patch)
tree07f39f119bb6030e15c6756a3495ebe90e9fdc68
parent91d211f71c7a460d419e799bb52244366700fe7f (diff)
downloadFreeBSD-src-4171b4e2c265add16cb3cc5fd92155377eda6460.zip
FreeBSD-src-4171b4e2c265add16cb3cc5fd92155377eda6460.tar.gz
This is a working version of the zlib version 1.2.4 but there are still some
rough edges that needs to be improved. Specifically: - zlib now uses off_t instead of long. So far I am fairly confident that this *should* work just fine but still needs further testing, etc. - The change from long to off_t requires users to rebuild all their binaries if linked with zlib. (Should we avoid the shared library version bump?) - We diveraged a little bit from official zlib's definition for their 64-bit variants. Technically we should have all these stuff without the 64 prefix since our off_t is 64 bit from the day 0 of FreeBSD 2.x, which is derived from 4.4BSD-Lite, while version 7.21 92/05/13 14:44:26 mckusick bumped it to 64-bit. Currently this is done with some direct changes in zlib.h and hack in zconf.h. - We need to import zlib's versioned symbols, perhaps the same of Linux's one provided with the distribution, or our own (since we bumped shared library version).
-rw-r--r--Makefile2
-rw-r--r--zconf.h13
-rw-r--r--zlib.h15
3 files changed, 15 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index a994870..f4d4bc4 100644
--- a/Makefile
+++ b/Makefile
@@ -14,7 +14,7 @@ MAN= zlib.3
CFLAGS+= -DHAS_snprintf -DHAS_vsnprintf -I${.CURDIR}
-WARNS?= 2
+WARNS?= 3
CLEANFILES+= example.o example foo.gz minigzip.o minigzip
diff --git a/zconf.h b/zconf.h
index 860358a..82d3af8 100644
--- a/zconf.h
+++ b/zconf.h
@@ -360,7 +360,7 @@ typedef uLong FAR uLongf;
typedef Byte *voidp;
#endif
-#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
+#if 0 /* was set to #if 0 by ./configure */
# define Z_HAVE_UNISTD_H
#endif
@@ -386,12 +386,13 @@ typedef uLong FAR uLongf;
#endif
/*
- * This is hard-configured for FreeBSD, since zlib doesn't actually support
- * using the system off_t for offsets unless off_t is no longer than long.
- * To minimize the diff, we just "undef z_off_t" rather than modifying
- * the following lines.
+ * This is hard-configured for FreeBSD.
*/
-#undef z_off_t
+#include <sys/types.h>
+#define z_off_t off_t
+#ifndef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 64
+#endif
#ifndef z_off_t
# define z_off_t long
diff --git a/zlib.h b/zlib.h
index f5785be..9012168 100644
--- a/zlib.h
+++ b/zlib.h
@@ -1563,6 +1563,13 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
ZEXTERN off64_t ZEXPORT gzoffset64 OF((gzFile));
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, off64_t));
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off64_t));
+#elif _FILE_OFFSET_BITS == 64
+ ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
+ ZEXTERN off_t ZEXPORT gzseek64 OF((gzFile, off_t, int));
+ ZEXTERN off_t ZEXPORT gztell64 OF((gzFile));
+ ZEXTERN off_t ZEXPORT gzoffset64 OF((gzFile));
+ ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, off_t));
+ ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off_t));
#endif
#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS == 64
@@ -1572,14 +1579,6 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits,
# define gzoffset gzoffset64
# define adler32_combine adler32_combine64
# define crc32_combine crc32_combine64
-# ifndef _LARGEFILE64_SOURCE
- ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
- ZEXTERN off_t ZEXPORT gzseek64 OF((gzFile, off_t, int));
- ZEXTERN off_t ZEXPORT gztell64 OF((gzFile));
- ZEXTERN off_t ZEXPORT gzoffset64 OF((gzFile));
- ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, off_t));
- ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off_t));
-# endif
#else
ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *));
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int));
OpenPOWER on IntegriCloud