19
19
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
20
20
Z_STREAM_ERROR if the level parameter is invalid.
21
21
*/
22
- int ZEXPORT compress2 (unsigned char * dest , uLong * destLen , const unsigned char * source ,
23
- uLong sourceLen , int level )
24
- {
22
+ int ZEXPORT compress2 (unsigned char * dest , uLong * destLen , const unsigned char * source ,
23
+ uLong sourceLen , int level ) {
25
24
z_stream stream ;
26
25
int err ;
27
26
28
27
stream .next_in = (const unsigned char * )source ;
29
28
stream .avail_in = (uInt )sourceLen ;
30
29
stream .next_out = dest ;
31
30
stream .avail_out = (uInt )* destLen ;
32
- if ((uLong )stream .avail_out != * destLen ) return Z_BUF_ERROR ;
31
+ if ((uLong )stream .avail_out != * destLen )
32
+ return Z_BUF_ERROR ;
33
33
34
34
stream .zalloc = (alloc_func )0 ;
35
35
stream .zfree = (free_func )0 ;
36
36
stream .opaque = NULL ;
37
37
38
38
err = deflateInit (& stream , level );
39
- if (err != Z_OK ) return err ;
39
+ if (err != Z_OK )
40
+ return err ;
40
41
41
42
err = deflate (& stream , Z_FINISH );
42
43
if (err != Z_STREAM_END ) {
@@ -51,17 +52,15 @@ int ZEXPORT compress2 (unsigned char *dest, uLong *destLen, const unsigned char
51
52
52
53
/* ===========================================================================
53
54
*/
54
- int ZEXPORT compress (unsigned char * dest , uLong * destLen , const unsigned char * source , uLong sourceLen )
55
- {
55
+ int ZEXPORT compress (unsigned char * dest , uLong * destLen , const unsigned char * source , uLong sourceLen ) {
56
56
return compress2 (dest , destLen , source , sourceLen , Z_DEFAULT_COMPRESSION );
57
57
}
58
58
59
59
/* ===========================================================================
60
60
If the default memLevel or windowBits for deflateInit() is changed, then
61
61
this function needs to be updated.
62
62
*/
63
- uLong ZEXPORT compressBound (uLong sourceLen )
64
- {
63
+ uLong ZEXPORT compressBound (uLong sourceLen ) {
65
64
return sourceLen + (sourceLen >> 12 ) + (sourceLen >> 14 ) +
66
65
(sourceLen >> 25 ) + 13 ;
67
66
}
0 commit comments