=========================================================================== Decompresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be large enough to hold the entire uncompressed data. (The size of the uncompressed data must have been saved previousl
(dest, destLen, source, sourceLen)
| 22 | buffer, or Z_DATA_ERROR if the input data was corrupted. |
| 23 | */ |
| 24 | int ZEXPORT uncompress (dest, destLen, source, sourceLen) |
| 25 | Bytef *dest; |
| 26 | uLongf *destLen; |
| 27 | const Bytef *source; |
| 28 | uLong sourceLen; |
| 29 | { |
| 30 | z_stream stream; |
| 31 | int err; |
| 32 | |
| 33 | stream.next_in = (z_const Bytef *)source; |
| 34 | stream.avail_in = (uInt)sourceLen; |
| 35 | /* Check for source > 64K on 16-bit machine: */ |
| 36 | if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; |
| 37 | |
| 38 | stream.next_out = dest; |
| 39 | stream.avail_out = (uInt)*destLen; |
| 40 | if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; |
| 41 | |
| 42 | stream.zalloc = (alloc_func)0; |
| 43 | stream.zfree = (free_func)0; |
| 44 | |
| 45 | err = inflateInit(&stream); |
| 46 | if (err != Z_OK) return err; |
| 47 | |
| 48 | err = inflate(&stream, Z_FINISH); |
| 49 | if (err != Z_STREAM_END) { |
| 50 | inflateEnd(&stream); |
| 51 | if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) |
| 52 | return Z_DATA_ERROR; |
| 53 | return err; |
| 54 | } |
| 55 | *destLen = stream.total_out; |
| 56 | |
| 57 | err = inflateEnd(&stream); |
| 58 | return err; |
| 59 | } |
nothing calls this directly
no outgoing calls
no test coverage detected