[Zlib-devel] zlib 1.2.3.2 available for testing

Mark Adler madler at alumni.caltech.edu
Wed Sep 6 17:14:48 EDT 2006


On Sep 6, 2006, at 12:04 PM, Lasse Collin wrote:
> Do it like it is done in C libraries: provide different function
> prototypes depending on _FILE_OFFSET_BITS, and use #define to rename
> them. Example:
>
> typedef off_t z_off_t;
> #if !defined(_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS == 32
> ZEXTERN z_off_t ZEXPORT    gzseek OF((gzFile file,
>                                       z_off_t offset, int whence));
> #elif _FILE_OFFSET_BITS == 64
> ZEXTERN z_off_t ZEXPORT    gzseek64 OF((gzFile file,
>                                       z_off_t offset, int whence));
> #define gzseek gzseek64
> #else
> #error Invalid value in _FILE_OFFSET_BITS.
> #endif

Ah, I thought that the suggestion from you and Mark Brown was to have  
two different versions, gzseek() and gzseek64(), available to the  
program.  In fact, you are proposing that only one of them is  
available after any invocation of zlib.h, depending on the setting of  
_FILE_OFFSET_BITS_.  If you can only use one of them, then the loss  
of the original off_t doesn't get in the way.

I will try to implement something like this in the next version.

> 64-bit platforms never had this problem, and some operating systems
> such as OpenBSD have always defined off_t to be 64-bit on 32-bit  
> archs.

Indeed my Mac OS X system is that way: off_t has always been 64  
bits.  Which I guess is part of why this all seems so lame to me.

mark





More information about the Zlib-devel mailing list