comparison zlib/uncompr.c @ 2690:9ef72ee5c0b0

Update vendored zlib to 1.3.1
author Michael Pavone <pavone@retrodev.com>
date Sun, 15 Jun 2025 15:39:33 -0700
parents 00d788dac91a
children
comparison
equal deleted inserted replaced
2689:bd6e33de0972 2690:9ef72ee5c0b0
22 uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough 22 uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough
23 memory, Z_BUF_ERROR if there was not enough room in the output buffer, or 23 memory, Z_BUF_ERROR if there was not enough room in the output buffer, or
24 Z_DATA_ERROR if the input data was corrupted, including if the input data is 24 Z_DATA_ERROR if the input data was corrupted, including if the input data is
25 an incomplete zlib stream. 25 an incomplete zlib stream.
26 */ 26 */
27 int ZEXPORT uncompress2 (dest, destLen, source, sourceLen) 27 int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source,
28 Bytef *dest; 28 uLong *sourceLen) {
29 uLongf *destLen;
30 const Bytef *source;
31 uLong *sourceLen;
32 {
33 z_stream stream; 29 z_stream stream;
34 int err; 30 int err;
35 const uInt max = (uInt)-1; 31 const uInt max = (uInt)-1;
36 uLong len, left; 32 uLong len, left;
37 Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */ 33 Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */
81 err == Z_NEED_DICT ? Z_DATA_ERROR : 77 err == Z_NEED_DICT ? Z_DATA_ERROR :
82 err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR : 78 err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR :
83 err; 79 err;
84 } 80 }
85 81
86 int ZEXPORT uncompress (dest, destLen, source, sourceLen) 82 int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, const Bytef *source,
87 Bytef *dest; 83 uLong sourceLen) {
88 uLongf *destLen;
89 const Bytef *source;
90 uLong sourceLen;
91 {
92 return uncompress2(dest, destLen, source, &sourceLen); 84 return uncompress2(dest, destLen, source, &sourceLen);
93 } 85 }