[Zlib-devel] zlib 1.2.3.2 available for testing
Lasse Collin
lasse.collin at tukaani.org
Wed Sep 6 07:12:47 EDT 2006
Mark Adler wrote:
> On Sep 5, 2006, at 1:21 PM, Lasse Collin wrote:
> > With zlib 1.2.3.2, this code doesn't compile without
> > _LARGEFILE64_SOURCE:
>
> I guess it would be uncouth to #define _LARGEFILE64_SOURCE in
> zlibdefs.h.
Not only uncouth but it wouldn't even work if sys/types.h had been
included before zlib.h.
> So if I use -D_FILE_OFFSET_BITS=64, then the code I compile with
> doesn't have to? Won't there then be type mismatches with routines
> that use off_t?
The application and library must be compiled with the same value of
_FILE_OFFSET_BITS, but only if the size of off_t matters in functions
used by the application. Most applications using zlib use only
deflate() and inflate() and their Init/Reset/End functions. Size of
z_off_t doesn't matter in these applications.
> It seems to me that if I'm changing the meaning of
> off_t, I'm in exactly as dangerous a situation, if not worse, as I
> would be in defining _LARGEFILE64_SOURCE which only changes the
> meaning of z_off_t.
Not in more dangerous situation than before 1.2.3.2. Most 32-bit
GNU/Linux systems have zlib compiled with 32-bit off_t, but 99% of apps
are compiled with 64-bit off_t. In other words, 99% of apps on those
systems can't use any functions of zlib that have z_off_t in their
declaration. That's why I think it is good to make zlib to use large
file support by default.
> Maybe zlib shouldn't bother with any of this at all, and just leave
> it to the user to force off_t to the right type.
Mark Brown's suggestion to implement both 32-bit and 64-bit versions of
functions that use off_t is definitely the most correct solution. That
would keep ABI backwards compatible when adding 64-bit functions.
Backwards compatiblity with old binaries is the reason why 32-bit
GNU/Linux supports both 32-bit and 64-bit off_t.
PS. What address should I use to post to this list? Most people seem to
use @zlib.net, but the headers have
List-Post: <mailto:zlib-devel at madler.net>
which makes my email client to use that address when pressing "reply to
mailing-list".
--
Lasse Collin | IRC: Larhzu @ IRCnet & Freenode
More information about the Zlib-devel
mailing list