diff options
| author | Mark Adler <git@madler.net> | 2026-01-12 09:29:40 -0800 |
|---|---|---|
| committer | Mark Adler <git@madler.net> | 2026-01-12 10:13:28 -0800 |
| commit | 4edb00de5aac7e4aa9110374bd1991c4d070eddb (patch) | |
| tree | 5a28fee50f6af03c57e0389a85be69b31727b340 /zlib.h | |
| parent | 1a40058a92d525aa49a6eac698cfde500fc9b92f (diff) | |
| download | zlib-4edb00de5aac7e4aa9110374bd1991c4d070eddb.tar.gz zlib-4edb00de5aac7e4aa9110374bd1991c4d070eddb.tar.bz2 zlib-4edb00de5aac7e4aa9110374bd1991c4d070eddb.zip | |
Add _z versions of the compress and uncompress functions.
Provide size_t arguments for Windows, on which a long is 32 bits.
Diffstat (limited to 'zlib.h')
| -rw-r--r-- | zlib.h | 37 |
1 files changed, 23 insertions, 14 deletions
| @@ -779,8 +779,8 @@ ZEXTERN z_size_t ZEXPORT deflateBound_z(z_streamp strm, z_size_t sourceLen); | |||
| 779 | be larger than the value returned by deflateBound() if flush options other | 779 | be larger than the value returned by deflateBound() if flush options other |
| 780 | than Z_FINISH or Z_NO_FLUSH are used. | 780 | than Z_FINISH or Z_NO_FLUSH are used. |
| 781 | 781 | ||
| 782 | delfateBound_z() is the same, but takes and returns a size_t length for | 782 | delfateBound_z() is the same, but takes and returns a size_t length. Note |
| 783 | those systems on which a long is 32 bits. | 783 | that a long is 32 bits on Windows. |
| 784 | */ | 784 | */ |
| 785 | 785 | ||
| 786 | ZEXTERN int ZEXPORT deflatePending(z_streamp strm, | 786 | ZEXTERN int ZEXPORT deflatePending(z_streamp strm, |
| @@ -1261,11 +1261,14 @@ ZEXTERN uLong ZEXPORT zlibCompileFlags(void); | |||
| 1261 | stream-oriented functions. To simplify the interface, some default options | 1261 | stream-oriented functions. To simplify the interface, some default options |
| 1262 | are assumed (compression level and memory usage, standard memory allocation | 1262 | are assumed (compression level and memory usage, standard memory allocation |
| 1263 | functions). The source code of these utility functions can be modified if | 1263 | functions). The source code of these utility functions can be modified if |
| 1264 | you need special options. | 1264 | you need special options. The _z versions of the functions use the size_t |
| 1265 | type for lengths. Note that a long is 32 bits on Windows. | ||
| 1265 | */ | 1266 | */ |
| 1266 | 1267 | ||
| 1267 | ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen, | 1268 | ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen, |
| 1268 | const Bytef *source, uLong sourceLen); | 1269 | const Bytef *source, uLong sourceLen); |
| 1270 | ZEXTERN int ZEXPORT compress_z(Bytef *dest, z_size_t *destLen, | ||
| 1271 | const Bytef *source, z_size_t sourceLen); | ||
| 1269 | /* | 1272 | /* |
| 1270 | Compresses the source buffer into the destination buffer. sourceLen is | 1273 | Compresses the source buffer into the destination buffer. sourceLen is |
| 1271 | the byte length of the source buffer. Upon entry, destLen is the total size | 1274 | the byte length of the source buffer. Upon entry, destLen is the total size |
| @@ -1279,9 +1282,12 @@ ZEXTERN int ZEXPORT compress(Bytef *dest, uLongf *destLen, | |||
| 1279 | buffer. | 1282 | buffer. |
| 1280 | */ | 1283 | */ |
| 1281 | 1284 | ||
| 1282 | ZEXTERN int ZEXPORT compress2(Bytef *dest, uLongf *destLen, | 1285 | ZEXTERN int ZEXPORT compress2(Bytef *dest, uLongf *destLen, |
| 1283 | const Bytef *source, uLong sourceLen, | 1286 | const Bytef *source, uLong sourceLen, |
| 1284 | int level); | 1287 | int level); |
| 1288 | ZEXTERN int ZEXPORT compress2_z(Bytef *dest, z_size_t *destLen, | ||
| 1289 | const Bytef *source, z_size_t sourceLen, | ||
| 1290 | int level); | ||
| 1285 | /* | 1291 | /* |
| 1286 | Compresses the source buffer into the destination buffer. The level | 1292 | Compresses the source buffer into the destination buffer. The level |
| 1287 | parameter has the same meaning as in deflateInit. sourceLen is the byte | 1293 | parameter has the same meaning as in deflateInit. sourceLen is the byte |
| @@ -1301,20 +1307,19 @@ ZEXTERN z_size_t ZEXPORT compressBound_z(z_size_t sourceLen); | |||
| 1301 | compressBound() returns an upper bound on the compressed size after | 1307 | compressBound() returns an upper bound on the compressed size after |
| 1302 | compress() or compress2() on sourceLen bytes. It would be used before a | 1308 | compress() or compress2() on sourceLen bytes. It would be used before a |
| 1303 | compress() or compress2() call to allocate the destination buffer. | 1309 | compress() or compress2() call to allocate the destination buffer. |
| 1304 | |||
| 1305 | compressBound_z() is the same, but takes and returns a size_t length for | ||
| 1306 | those systems on which a long is 32 bits. | ||
| 1307 | */ | 1310 | */ |
| 1308 | 1311 | ||
| 1309 | ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, | 1312 | ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, |
| 1310 | const Bytef *source, uLong sourceLen); | 1313 | const Bytef *source, uLong sourceLen); |
| 1314 | ZEXTERN int ZEXPORT uncompress_z(Bytef *dest, z_size_t *destLen, | ||
| 1315 | const Bytef *source, z_size_t sourceLen); | ||
| 1311 | /* | 1316 | /* |
| 1312 | Decompresses the source buffer into the destination buffer. sourceLen is | 1317 | Decompresses the source buffer into the destination buffer. sourceLen is |
| 1313 | the byte length of the source buffer. Upon entry, destLen is the total size | 1318 | the byte length of the source buffer. On entry, *destLen is the total size |
| 1314 | of the destination buffer, which must be large enough to hold the entire | 1319 | of the destination buffer, which must be large enough to hold the entire |
| 1315 | uncompressed data. (The size of the uncompressed data must have been saved | 1320 | uncompressed data. (The size of the uncompressed data must have been saved |
| 1316 | previously by the compressor and transmitted to the decompressor by some | 1321 | previously by the compressor and transmitted to the decompressor by some |
| 1317 | mechanism outside the scope of this compression library.) Upon exit, destLen | 1322 | mechanism outside the scope of this compression library.) On exit, *destLen |
| 1318 | is the actual size of the uncompressed data. | 1323 | is the actual size of the uncompressed data. |
| 1319 | 1324 | ||
| 1320 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not | 1325 | uncompress returns Z_OK if success, Z_MEM_ERROR if there was not |
| @@ -1324,8 +1329,10 @@ ZEXTERN int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, | |||
| 1324 | buffer with the uncompressed data up to that point. | 1329 | buffer with the uncompressed data up to that point. |
| 1325 | */ | 1330 | */ |
| 1326 | 1331 | ||
| 1327 | ZEXTERN int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, | 1332 | ZEXTERN int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, |
| 1328 | const Bytef *source, uLong *sourceLen); | 1333 | const Bytef *source, uLong *sourceLen); |
| 1334 | ZEXTERN int ZEXPORT uncompress2_z(Bytef *dest, z_size_t *destLen, | ||
| 1335 | const Bytef *source, z_size_t *sourceLen); | ||
| 1329 | /* | 1336 | /* |
| 1330 | Same as uncompress, except that sourceLen is a pointer, where the | 1337 | Same as uncompress, except that sourceLen is a pointer, where the |
| 1331 | length of the source is *sourceLen. On return, *sourceLen is the number of | 1338 | length of the source is *sourceLen. On return, *sourceLen is the number of |
| @@ -1819,7 +1826,8 @@ ZEXTERN uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len); | |||
| 1819 | ZEXTERN uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, | 1826 | ZEXTERN uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, |
| 1820 | z_size_t len); | 1827 | z_size_t len); |
| 1821 | /* | 1828 | /* |
| 1822 | Same as adler32(), but with a size_t length. | 1829 | Same as adler32(), but with a size_t length. Note that a long is 32 bits |
| 1830 | on Windows. | ||
| 1823 | */ | 1831 | */ |
| 1824 | 1832 | ||
| 1825 | /* | 1833 | /* |
| @@ -1855,7 +1863,8 @@ ZEXTERN uLong ZEXPORT crc32(uLong crc, const Bytef *buf, uInt len); | |||
| 1855 | ZEXTERN uLong ZEXPORT crc32_z(uLong crc, const Bytef *buf, | 1863 | ZEXTERN uLong ZEXPORT crc32_z(uLong crc, const Bytef *buf, |
| 1856 | z_size_t len); | 1864 | z_size_t len); |
| 1857 | /* | 1865 | /* |
| 1858 | Same as crc32(), but with a size_t length. | 1866 | Same as crc32(), but with a size_t length. Note that a long is 32 bits on |
| 1867 | Windows. | ||
| 1859 | */ | 1868 | */ |
| 1860 | 1869 | ||
| 1861 | /* | 1870 | /* |
