Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: third_party/zlib/uncompr.c

Issue 2084863002: Update Zlib to version 1.2.8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/zlib/trees.c ('k') | third_party/zlib/zconf.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* uncompr.c -- decompress a memory buffer 1 /* uncompr.c -- decompress a memory buffer
2 * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. 2 * Copyright (C) 1995-2003, 2010 Jean-loup Gailly.
3 * For conditions of distribution and use, see copyright notice in zlib.h 3 * For conditions of distribution and use, see copyright notice in zlib.h
4 */ 4 */
5 5
6 /* @(#) $Id$ */ 6 /* @(#) $Id$ */
7 7
8 #define ZLIB_INTERNAL 8 #define ZLIB_INTERNAL
9 #include "zlib.h" 9 #include "zlib.h"
10 10
(...skipping 12 matching lines...) Expand all
23 */ 23 */
24 int ZEXPORT uncompress (dest, destLen, source, sourceLen) 24 int ZEXPORT uncompress (dest, destLen, source, sourceLen)
25 Bytef *dest; 25 Bytef *dest;
26 uLongf *destLen; 26 uLongf *destLen;
27 const Bytef *source; 27 const Bytef *source;
28 uLong sourceLen; 28 uLong sourceLen;
29 { 29 {
30 z_stream stream; 30 z_stream stream;
31 int err; 31 int err;
32 32
33 stream.next_in = (Bytef*)source; 33 stream.next_in = (z_const Bytef *)source;
34 stream.avail_in = (uInt)sourceLen; 34 stream.avail_in = (uInt)sourceLen;
35 /* Check for source > 64K on 16-bit machine: */ 35 /* Check for source > 64K on 16-bit machine: */
36 if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; 36 if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
37 37
38 stream.next_out = dest; 38 stream.next_out = dest;
39 stream.avail_out = (uInt)*destLen; 39 stream.avail_out = (uInt)*destLen;
40 if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; 40 if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR;
41 41
42 stream.zalloc = (alloc_func)0; 42 stream.zalloc = (alloc_func)0;
43 stream.zfree = (free_func)0; 43 stream.zfree = (free_func)0;
44 44
45 err = inflateInit(&stream); 45 err = inflateInit(&stream);
46 if (err != Z_OK) return err; 46 if (err != Z_OK) return err;
47 47
48 err = inflate(&stream, Z_FINISH); 48 err = inflate(&stream, Z_FINISH);
49 if (err != Z_STREAM_END) { 49 if (err != Z_STREAM_END) {
50 inflateEnd(&stream); 50 inflateEnd(&stream);
51 if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) 51 if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0))
52 return Z_DATA_ERROR; 52 return Z_DATA_ERROR;
53 return err; 53 return err;
54 } 54 }
55 *destLen = stream.total_out; 55 *destLen = stream.total_out;
56 56
57 err = inflateEnd(&stream); 57 err = inflateEnd(&stream);
58 return err; 58 return err;
59 } 59 }
OLDNEW
« no previous file with comments | « third_party/zlib/trees.c ('k') | third_party/zlib/zconf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698