[Zlib-devel] zlib 1.2.3.2 available for testing

Lasse Collin lasse.collin at tukaani.org
Tue Sep 5 15:35:37 EDT 2006


William A. Rowe, Jr. wrote:
> Lasse Collin wrote:
> > On 32-bit archs, gzseek() doesn't work in transparent mode with
> > large files when seeking past 2 GiB. Line 822 in gzio.c of zlib
> > 1.2.3.2 calls fseek(), which takes only 32-bit offset (type
> > "long"). A solution would be using fseeko() or fseeko64(), which
> > take off_t or off64_t argument. Maybe all fseek()s should be
> > converted to fseeko()/fseeko64() and ftell()s to
> > ftello()/ftello64() when these functions are available.
>
> +1 if not explicitly building to 32 bits.

If _FILE_OFFSET_BITS=64 is used for enabling large file support, you can 
always use off_t and fseeko() when they are available. Depending on 
_FILE_OFFSET_BITS, off_t will be 32-bit or 64-bit, and fseeko() will 
point to the correct variant of that function.

To summarize, configure could
  - always define _FILE_OFFSET_BITS=64 unless explicitly building
    without large file support;
  - test for availability of fseeko(), and #define zseek and ztell
    to point either to fseek() & ftell() or fseeko() & ftello();
  - unset _FILE_OFFSET_BITS if fseeko() is not available (just in case).

-- 
Lasse Collin  |  IRC: Larhzu @ IRCnet & Freenode




More information about the Zlib-devel mailing list