}
/* ========================================================================= */
+#ifdef ZLIB_COMPAT
uint32_t ZEXPORT PREFIX(adler32_combine)(uint32_t adler1, uint32_t adler2, z_off_t len2) {
return adler32_combine_(adler1, adler2, len2);
}
+#endif
-uint32_t ZEXPORT PREFIX(adler32_combine64)(uint32_t adler1, uint32_t adler2, z_off64_t len2) {
+uint32_t ZEXPORT PREFIX4(adler32_combine)(uint32_t adler1, uint32_t adler2, z_off64_t len2) {
return adler32_combine_(adler1, adler2, len2);
}
}
/* ========================================================================= */
+#ifdef ZLIB_COMPAT
uint32_t ZEXPORT PREFIX(crc32_combine)(uint32_t crc1, uint32_t crc2, z_off_t len2) {
return crc32_combine_(crc1, crc2, len2);
}
+#endif
-uint32_t ZEXPORT PREFIX(crc32_combine64)(uint32_t crc1, uint32_t crc2, z_off64_t len2) {
+uint32_t ZEXPORT PREFIX4(crc32_combine)(uint32_t crc1, uint32_t crc2, z_off64_t len2) {
return crc32_combine_(crc1, crc2, len2);
}
/* ========================================================================= */
+#ifdef ZLIB_COMPAT
void ZEXPORT PREFIX(crc32_combine_gen)(uint32_t *op, z_off_t len2) {
crc32_combine_gen_(op, len2);
}
+#endif
-void ZEXPORT PREFIX(crc32_combine_gen64)(uint32_t *op, z_off64_t len2) {
+void ZEXPORT PREFIX4(crc32_combine_gen)(uint32_t *op, z_off64_t len2) {
crc32_combine_gen_(op, len2);
}
# define zstrerror() "stdio error (consult errno)"
#endif
-/* provide prototypes for these when building zlib without LFS */
-#if (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) && defined(WITH_GZFILEOP)
- ZEXTERN gzFile ZEXPORT PREFIX(gzopen64)(const char *, const char *);
- ZEXTERN z_off64_t ZEXPORT PREFIX(gzseek64)(gzFile, z_off64_t, int);
- ZEXTERN z_off64_t ZEXPORT PREFIX(gztell64)(gzFile);
- ZEXTERN z_off64_t ZEXPORT PREFIX(gzoffset64)(gzFile);
-#endif
-
/* default memLevel */
#if MAX_MEM_LEVEL >= 8
# define DEF_MEM_LEVEL 8
return gz_open(path, -1, mode);
}
-/* -- see zlib.h -- */
-gzFile ZEXPORT PREFIX(gzopen64)(const char *path, const char *mode) {
+#ifdef ZLIB_COMPAT
+gzFile ZEXPORT PREFIX4(gzopen)(const char *path, const char *mode) {
return gz_open(path, -1, mode);
}
+#endif
/* -- see zlib.h -- */
gzFile ZEXPORT PREFIX(gzdopen)(int fd, const char *mode) {
}
/* -- see zlib.h -- */
-z_off64_t ZEXPORT PREFIX(gzseek64)(gzFile file, z_off64_t offset, int whence) {
+z_off64_t ZEXPORT PREFIX4(gzseek)(gzFile file, z_off64_t offset, int whence) {
unsigned n;
z_off64_t ret;
gz_state *state;
}
/* -- see zlib.h -- */
+#ifdef ZLIB_COMPAT
z_off_t ZEXPORT PREFIX(gzseek)(gzFile file, z_off_t offset, int whence) {
z_off64_t ret;
- ret = PREFIX(gzseek64)(file, (z_off64_t)offset, whence);
+ ret = PREFIX4(gzseek)(file, (z_off64_t)offset, whence);
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
}
+#endif
/* -- see zlib.h -- */
-z_off64_t ZEXPORT PREFIX(gztell64)(gzFile file) {
+z_off64_t ZEXPORT PREFIX4(gztell)(gzFile file) {
gz_state *state;
/* get internal structure and check integrity */
}
/* -- see zlib.h -- */
+#ifdef ZLIB_COMPAT
z_off_t ZEXPORT PREFIX(gztell)(gzFile file) {
+
z_off64_t ret;
- ret = PREFIX(gztell64)(file);
+ ret = PREFIX4(gztell)(file);
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
}
+#endif
/* -- see zlib.h -- */
-z_off64_t ZEXPORT PREFIX(gzoffset64)(gzFile file) {
+z_off64_t ZEXPORT PREFIX4(gzoffset)(gzFile file) {
z_off64_t offset;
gz_state *state;
}
/* -- see zlib.h -- */
+#ifdef ZLIB_COMPAT
z_off_t ZEXPORT PREFIX(gzoffset)(gzFile file) {
z_off64_t ret;
- ret = PREFIX(gzoffset64)(file);
+ ret = PREFIX4(gzoffset)(file);
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
}
+#endif
/* -- see zlib.h -- */
int ZEXPORT PREFIX(gzeof)(gzFile file) {
zng_compressBound
zng_uncompress
zng_uncompress2
-; large file functions
- zng_adler32_combine64
- zng_crc32_combine64
; checksum functions
zng_adler32
zng_adler32_z
# define PREFIX(x) x
# define PREFIX2(x) ZLIB_ ## x
# define PREFIX3(x) z_ ## x
+# define PREFIX4(x) x ## 64
# define zVersion zlibVersion
# define z_size_t unsigned long
#else
# define PREFIX(x) zng_ ## x
# define PREFIX2(x) ZLIBNG_ ## x
# define PREFIX3(x) zng_ ## x
+# define PREFIX4(x) zng_ ## x
# define zVersion zlibng_version
# define z_size_t size_t
#endif
# endif
#endif
-#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
-# define Z_LFS64
-#endif
-
-#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
-# define Z_LARGE64
-#endif
-
-#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
-# define Z_WANT64
-#endif
-
#if !defined(SEEK_SET)
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
-/*
ZEXTERN ZEXPORT
gzFile zng_gzopen(const char *path, const char *mode);
-
+/*
Opens a gzip (.gz) file for reading or writing. The mode parameter is as
in fopen ("rb" or "wb") but can also include a compression level ("wb9") or
a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
degrade compression if called too often.
*/
-/*
ZEXTERN ZEXPORT
-z_off_t zng_gzseek(gzFile file, z_off_t offset, int whence);
-
+z_off64_t zng_gzseek(gzFile file, z_off64_t offset, int whence);
+/*
Sets the starting position for the next gzread or gzwrite on the given
compressed file. The offset represents a number of bytes in the
uncompressed data stream. The whence parameter is defined as in lseek(2);
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
*/
-/*
ZEXTERN ZEXPORT
-z_off_t zng_gztell(gzFile file);
-
+z_off64_t zng_gztell(gzFile file);
+/*
Returns the starting position for the next gzread or gzwrite on the given
compressed file. This position represents a number of bytes in the
uncompressed data stream, and is zero when starting, even if appending or
gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
*/
-/*
ZEXTERN ZEXPORT
-z_off_t zng_gzoffset(gzFile file);
-
+z_off64_t zng_gzoffset(gzFile file);
+/*
Returns the current offset in the file being read or written. This offset
includes the count of bytes that precede the gzip stream, for example when
appending or when using gzdopen() for reading. When reading, the offset
Same as adler32(), but with a size_t length.
*/
-/*
ZEXTERN ZEXPORT
-uint32_t zng_adler32_combine(uint32_t adler1, uint32_t adler2, z_off_t len2);
-
+uint32_t zng_adler32_combine(uint32_t adler1, uint32_t adler2, z_off64_t len2);
+/*
Combine two Adler-32 checksums into one. For two sequences of bytes, seq1
and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of
Same as crc32(), but with a size_t length.
*/
-/*
ZEXTERN ZEXPORT
uint32_t zng_crc32_combine(uint32_t crc1, uint32_t crc2, z_off64_t len2);
+/*
Combine two CRC-32 check values into one. For two sequences of bytes,
seq1 and seq2 with lengths len1 and len2, CRC-32 check values were
calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32
len2.
*/
-/*
ZEXTERN ZEXPORT
-void zng_crc32_combine_gen(uint32_t op[32], z_off_t len2);
+void zng_crc32_combine_gen(uint32_t op[32], z_off64_t len2);
+/*
Generate the operator op corresponding to length len2, to be used with
crc32_combine_op(). op must have room for 32 uint32_t values. (32 is the
number of bits in the CRC.)
ZEXTERN ZEXPORT int zng_gzgetc_(gzFile file); /* backward compatibility */
# define zng_gzgetc(g) ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (zng_gzgetc)(g))
-/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
- * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
- * both are true, the application gets the *64 functions, and the regular
- * functions are changed to 64 bits) -- in case these are set on systems
- * without large file support, _LFS64_LARGEFILE must also be true
- */
-#ifdef Z_LARGE64
- ZEXTERN ZEXPORT gzFile zng_gzopen64(const char *, const char *);
- ZEXTERN ZEXPORT z_off64_t zng_gzseek64(gzFile, z_off64_t, int);
- ZEXTERN ZEXPORT z_off64_t zng_gztell64(gzFile);
- ZEXTERN ZEXPORT z_off64_t zng_gzoffset64(gzFile);
-#endif
-
-#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
-# define zng_gzopen zng_gzopen64
-# define zng_gzseek zng_gzseek64
-# define zng_gztell zng_gztell64
-# define zng_gzoffset zng_gzoffset64
-# ifndef Z_LARGE64
- ZEXTERN ZEXPORT gzFile zng_gzopen64(const char *, const char *);
- ZEXTERN ZEXPORT z_off_t zng_gzseek64(gzFile, z_off_t, int);
- ZEXTERN ZEXPORT z_off_t zng_gztell64(gzFile);
- ZEXTERN ZEXPORT z_off_t zng_gzoffset64(gzFile);
-# endif
-#else
- ZEXTERN ZEXPORT gzFile zng_gzopen(const char *, const char *);
- ZEXTERN ZEXPORT z_off_t zng_gzseek(gzFile, z_off_t, int);
- ZEXTERN ZEXPORT z_off_t zng_gztell(gzFile);
- ZEXTERN ZEXPORT z_off_t zng_gzoffset(gzFile);
-#endif
#endif /* WITH_GZFILEOP */
entire value of the corresponding parameter.
*/
-
-/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
- * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
- * both are true, the application gets the *64 functions, and the regular
- * functions are changed to 64 bits) -- in case these are set on systems
- * without large file support, _LFS64_LARGEFILE must also be true
- */
-#ifdef Z_LARGE64
- ZEXTERN ZEXPORT uint32_t zng_adler32_combine64(uint32_t, uint32_t, z_off64_t);
- ZEXTERN ZEXPORT uint32_t zng_crc32_combine64(uint32_t, uint32_t, z_off64_t);
- ZEXTERN ZEXPORT void zng_crc32_combine_gen64(uint32_t *op, z_off64_t);
-#endif
-
-#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
-# define zng_adler32_combine zng_adler32_combine64
-# define zng_crc32_combine zng_crc32_combine64
-# define zng_crc32_combine_gen zng_crc32_combine_gen64
-# ifndef Z_LARGE64
- ZEXTERN ZEXPORT uint32_t zng_adler32_combine64(uint32_t, uint32_t, z_off_t);
- ZEXTERN ZEXPORT uint32_t zng_crc32_combine64(uint32_t, uint32_t, z_off_t);
- ZEXTERN ZEXPORT void zng_crc32_combine_gen64(uint32_t *op, z_off64_t);
-# endif
-#else
- ZEXTERN ZEXPORT uint32_t zng_adler32_combine(uint32_t, uint32_t, z_off_t);
- ZEXTERN ZEXPORT uint32_t zng_crc32_combine(uint32_t, uint32_t, z_off_t);
- ZEXTERN ZEXPORT void zng_crc32_combine_gen(uint32_t *op, z_off_t);
-#endif
-
-
/* undocumented functions */
ZEXTERN ZEXPORT const char * zng_zError (int);
ZEXTERN ZEXPORT int zng_inflateSyncPoint (zng_stream *);
zng_adler32;
zng_adler32_c;
zng_adler32_combine;
- zng_adler32_combine64;
zng_adler32_z;
zng_compress;
zng_compress2;
zng_compressBound;
zng_crc32;
zng_crc32_combine;
- zng_crc32_combine64;
zng_crc32_combine_gen;
zng_crc32_combine_op;
zng_crc32_z;
ZEXTERN z_off64_t ZEXPORT gzseek64(gzFile, z_off64_t, int);
ZEXTERN z_off64_t ZEXPORT gztell64(gzFile);
ZEXTERN z_off64_t ZEXPORT gzoffset64(gzFile);
+ ZEXTERN uint32_t ZEXPORT adler32_combine64(uint32_t, uint32_t, z_off64_t);
+ ZEXTERN uint32_t ZEXPORT crc32_combine64(uint32_t, uint32_t, z_off64_t);
+ ZEXTERN void ZEXPORT crc32_combine_gen64(uint32_t *op, z_off64_t);
#endif
#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
# define gzseek gzseek64
# define gztell gztell64
# define gzoffset gzoffset64
+# define adler32_combine adler32_combine64
+# define crc32_combine crc32_combine64
+# define crc32_combine_gen crc32_combine_gen64
# ifndef Z_LARGE64
ZEXTERN gzFile ZEXPORT gzopen64(const char *, const char *);
ZEXTERN z_off_t ZEXPORT gzseek64(gzFile, z_off_t, int);
ZEXTERN z_off_t ZEXPORT gztell64(gzFile);
ZEXTERN z_off_t ZEXPORT gzoffset64(gzFile);
+ ZEXTERN uint32_t ZEXPORT adler32_combine64(uint32_t, uint32_t, z_off_t);
+ ZEXTERN uint32_t ZEXPORT crc32_combine64(uint32_t, uint32_t, z_off_t);
+ ZEXTERN void ZEXPORT crc32_combine_gen64(uint32_t *op, z_off64_t);
# endif
#else
ZEXTERN gzFile ZEXPORT gzopen(const char *, const char *);
ZEXTERN z_off_t ZEXPORT gzseek(gzFile, z_off_t, int);
ZEXTERN z_off_t ZEXPORT gztell(gzFile);
ZEXTERN z_off_t ZEXPORT gzoffset(gzFile);
-#endif
-
-
-/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
- * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
- * both are true, the application gets the *64 functions, and the regular
- * functions are changed to 64 bits) -- in case these are set on systems
- * without large file support, _LFS64_LARGEFILE must also be true
- */
-#ifdef Z_LARGE64
- ZEXTERN uint32_t ZEXPORT adler32_combine64(uint32_t, uint32_t, z_off64_t);
- ZEXTERN uint32_t ZEXPORT crc32_combine64(uint32_t, uint32_t, z_off64_t);
- ZEXTERN void ZEXPORT crc32_combine_gen64(uint32_t *op, z_off64_t);
-#endif
-
-#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64)
-# define adler32_combine adler32_combine64
-# define crc32_combine crc32_combine64
-# define crc32_combine_gen crc32_combine_gen64
-# ifndef Z_LARGE64
- ZEXTERN uint32_t ZEXPORT adler32_combine64(uint32_t, uint32_t, z_off_t);
- ZEXTERN uint32_t ZEXPORT crc32_combine64(uint32_t, uint32_t, z_off_t);
- ZEXTERN void ZEXPORT crc32_combine_gen64(uint32_t *op, z_off64_t);
-# endif
-#else
ZEXTERN uint32_t ZEXPORT adler32_combine(uint32_t, uint32_t, z_off_t);
ZEXTERN uint32_t ZEXPORT crc32_combine(uint32_t, uint32_t, z_off_t);
ZEXTERN void ZEXPORT crc32_combine_gen(uint32_t *op, z_off_t);
#endif
-
/* undocumented functions */
ZEXTERN const char * ZEXPORT zError (int);
ZEXTERN int ZEXPORT inflateSyncPoint (z_stream *);
# define fdopen(fd, type) _fdopen(fd, type)
#endif
-/* provide prototypes for these when building zlib without LFS */
-#if !defined(_WIN32) && !defined(__MSYS__) && (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
-# include "zbuild.h" /* For PREFIX() */
- ZEXTERN uint32_t ZEXPORT PREFIX(adler32_combine64)(uint32_t, uint32_t, z_off_t);
- ZEXTERN uint32_t ZEXPORT PREFIX(crc32_combine64)(uint32_t, uint32_t, z_off_t);
-#endif
-
/* MS Visual Studio does not allow inline in C, only C++.
But it provides __inline instead, so use that. */
#if defined(_MSC_VER) && !defined(inline) && !defined(__cplusplus)