[Zlib-devel] [PATCH] Avoid testing _LARGEFILE_64_SOURCE and _FILE_OFFSET_BITS directly

Xin LI delphij at gmail.com
Fri Mar 26 15:04:26 EDT 2010


Hi,

Here is a patch that avoids testing _LARGEFILE_64_SOURCE and
_FILE_OFFSET_BITS directly in zlib.h.

*BSDs (including Mac OS X) have 64-bit off_t from the day 1 as
inherited from BSD Unix as I have verified from 44BSD's SCCS tree (the
original change happened in revision 7.21 92/05/13 14:44:26 by
mckusick).  Also, _LARGEFILE_64_SOURCE doesn't apply to us and
_FILE_OFFSET_BITS is not defined on these platforms.

Unfortunately some third party programs defines _LARGEFILE_64_SOURCE
when compiling on FreeBSD as a workaround, as reported by some Gentoo
developers.  This would break zlib.h definations since zlib uses
_LARGEFILE_64_SOURCE as an indicator of availability of *64 functions.

The proposed change make zlib more platform neutral.  It introduces
two namespaced macros: ZLIB_FILE_OFFSET_BITS and
ZLIB_LARGEFILE_64_SOURCE.  For *BSD and Mac OS X,
ZLIB_FILE_OFFSET_BITS would be defined as 64; for non-BSD platforms,
ZLIB_FILE_OFFSET_BITS would be dependent of _FILE_OFFSET_BITS.

(gzguts.h has been intentionally left out since it's not meant to be
used by third parties).

Cheers,
-- 
Xin LI <delphij at delphij.net> http://www.delphij.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zlib-namespace.diff
Type: application/octet-stream
Size: 3106 bytes
Desc: not available
URL: <http://madler.net/pipermail/zlib-devel_madler.net/attachments/20100326/54b446a7/attachment.obj>


More information about the Zlib-devel mailing list