OLD | NEW |
1 /* compress.c -- compress a memory buffer | 1 /* compress.c -- compress a memory buffer |
2 * Copyright (C) 1995-2003 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: compress.c,v 3.6 2005/08/04 19:14:14 tor%cs.brown.edu Exp $ */ | 6 /* @(#) $Id$ */ |
7 | 7 |
8 #define ZLIB_INTERNAL | 8 #define ZLIB_INTERNAL |
9 #include "zlib.h" | 9 #include "zlib.h" |
10 | 10 |
11 /* =========================================================================== | 11 /* =========================================================================== |
12 Compresses the source buffer into the destination buffer. The level | 12 Compresses the source buffer into the destination buffer. The level |
13 parameter has the same meaning as in deflateInit. sourceLen is the byte | 13 parameter has the same meaning as in deflateInit. sourceLen is the byte |
14 length of the source buffer. Upon entry, destLen is the total size of the | 14 length of the source buffer. Upon entry, destLen is the total size of the |
15 destination buffer, which must be at least 0.1% larger than sourceLen plus | 15 destination buffer, which must be at least 0.1% larger than sourceLen plus |
16 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. | 16 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); | 68 return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); |
69 } | 69 } |
70 | 70 |
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) + 11; | 78 return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + |
| 79 (sourceLen >> 25) + 13; |
79 } | 80 } |
OLD | NEW |