svn commit: r205306 - user/delphij/libz
Xin LI
delphij at FreeBSD.org
Fri Mar 19 00:51:48 UTC 2010
Author: delphij
Date: Fri Mar 19 00:51:48 2010
New Revision: 205306
URL: http://svn.freebsd.org/changeset/base/205306
Log:
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).
Modified:
user/delphij/libz/Makefile
user/delphij/libz/zconf.h
user/delphij/libz/zlib.h
Modified: user/delphij/libz/Makefile
==============================================================================
--- user/delphij/libz/Makefile Fri Mar 19 00:33:49 2010 (r205305)
+++ user/delphij/libz/Makefile Fri Mar 19 00:51:48 2010 (r205306)
@@ -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
Modified: user/delphij/libz/zconf.h
==============================================================================
--- user/delphij/libz/zconf.h Fri Mar 19 00:33:49 2010 (r205305)
+++ user/delphij/libz/zconf.h Fri Mar 19 00:51:48 2010 (r205306)
@@ -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
Modified: user/delphij/libz/zlib.h
==============================================================================
--- user/delphij/libz/zlib.h Fri Mar 19 00:33:49 2010 (r205305)
+++ user/delphij/libz/zlib.h Fri Mar 19 00:51:48 2010 (r205306)
@@ -1563,6 +1563,13 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF(
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(
# 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));
More information about the svn-src-user
mailing list