OLD | NEW |
1 /* compress.c -- compress a memory buffer | 1 /* compress.c -- compress a memory buffer |
2 * Copyright (C) 1995-2005 Jean-loup Gailly. | 2 * Copyright (C) 1995-2005 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 11 matching lines...) Expand all Loading... |
22 int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) | 22 int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) |
23 Bytef *dest; | 23 Bytef *dest; |
24 uLongf *destLen; | 24 uLongf *destLen; |
25 const Bytef *source; | 25 const Bytef *source; |
26 uLong sourceLen; | 26 uLong sourceLen; |
27 int level; | 27 int level; |
28 { | 28 { |
29 z_stream stream; | 29 z_stream stream; |
30 int err; | 30 int err; |
31 | 31 |
32 stream.next_in = (Bytef*)source; | 32 stream.next_in = (z_const Bytef *)source; |
33 stream.avail_in = (uInt)sourceLen; | 33 stream.avail_in = (uInt)sourceLen; |
34 #ifdef MAXSEG_64K | 34 #ifdef MAXSEG_64K |
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 #endif | 37 #endif |
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; |
(...skipping 28 matching lines...) Expand all Loading... |
71 /* =========================================================================== | 71 /* =========================================================================== |
72 If the default memLevel or windowBits for deflateInit() is changed, then | 72 If the default memLevel or windowBits for deflateInit() is changed, then |
73 this function needs to be updated. | 73 this function needs to be updated. |
74 */ | 74 */ |
75 uLong ZEXPORT compressBound (sourceLen) | 75 uLong ZEXPORT compressBound (sourceLen) |
76 uLong sourceLen; | 76 uLong sourceLen; |
77 { | 77 { |
78 return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + | 78 return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + |
79 (sourceLen >> 25) + 13; | 79 (sourceLen >> 25) + 13; |
80 } | 80 } |
OLD | NEW |