uncompr.c (e37bb444aa945ed0725766e986698a09bd61b1b2) | uncompr.c (4717628ed859513a3262ea68259d0605f39de0b3) |
---|---|
1/* uncompr.c -- decompress a memory buffer 2 * Copyright (C) 1995-2003, 2010, 2014, 2016 Jean-loup Gailly, Mark Adler 3 * For conditions of distribution and use, see copyright notice in zlib.h 4 */ 5 6/* @(#) $Id$ */ 7 8#define ZLIB_INTERNAL --- 10 unchanged lines hidden (view full) --- 19 of source bytes consumed. Upon return, source + *sourceLen points to the 20 first unused input byte. 21 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 24 Z_DATA_ERROR if the input data was corrupted, including if the input data is 25 an incomplete zlib stream. 26*/ | 1/* uncompr.c -- decompress a memory buffer 2 * Copyright (C) 1995-2003, 2010, 2014, 2016 Jean-loup Gailly, Mark Adler 3 * For conditions of distribution and use, see copyright notice in zlib.h 4 */ 5 6/* @(#) $Id$ */ 7 8#define ZLIB_INTERNAL --- 10 unchanged lines hidden (view full) --- 19 of source bytes consumed. Upon return, source + *sourceLen points to the 20 first unused input byte. 21 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 24 Z_DATA_ERROR if the input data was corrupted, including if the input data is 25 an incomplete zlib stream. 26*/ |
27int ZEXPORT uncompress2(dest, destLen, source, sourceLen) 28 Bytef *dest; 29 uLongf *destLen; 30 const Bytef *source; 31 uLong *sourceLen; 32{ | 27int ZEXPORT uncompress2(Bytef *dest, uLongf *destLen, const Bytef *source, 28 uLong *sourceLen) { |
33 z_stream stream; 34 int err; 35 const uInt max = (uInt)-1; 36 uLong len, left; 37 Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */ 38 39 len = *sourceLen; 40 if (*destLen) { --- 37 unchanged lines hidden (view full) --- 78 79 inflateEnd(&stream); 80 return err == Z_STREAM_END ? Z_OK : 81 err == Z_NEED_DICT ? Z_DATA_ERROR : 82 err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR : 83 err; 84} 85 | 29 z_stream stream; 30 int err; 31 const uInt max = (uInt)-1; 32 uLong len, left; 33 Byte buf[1]; /* for detection of incomplete stream when *destLen == 0 */ 34 35 len = *sourceLen; 36 if (*destLen) { --- 37 unchanged lines hidden (view full) --- 74 75 inflateEnd(&stream); 76 return err == Z_STREAM_END ? Z_OK : 77 err == Z_NEED_DICT ? Z_DATA_ERROR : 78 err == Z_BUF_ERROR && left + stream.avail_out ? Z_DATA_ERROR : 79 err; 80} 81 |
86int ZEXPORT uncompress(dest, destLen, source, sourceLen) 87 Bytef *dest; 88 uLongf *destLen; 89 const Bytef *source; 90 uLong sourceLen; 91{ | 82int ZEXPORT uncompress(Bytef *dest, uLongf *destLen, const Bytef *source, 83 uLong sourceLen) { |
92 return uncompress2(dest, destLen, source, &sourceLen); 93} | 84 return uncompress2(dest, destLen, source, &sourceLen); 85} |