Skip to content

Commit ae0043b

Browse files
committed
Style cleanup for compress/uncompress and longest_match code
1 parent acfaa63 commit ae0043b

File tree

4 files changed

+244
-245
lines changed

4 files changed

+244
-245
lines changed

compress.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,25 @@
1919
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
2020
Z_STREAM_ERROR if the level parameter is invalid.
2121
*/
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) {
2524
z_stream stream;
2625
int err;
2726

2827
stream.next_in = (const unsigned char *)source;
2928
stream.avail_in = (uInt)sourceLen;
3029
stream.next_out = dest;
3130
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;
3333

3434
stream.zalloc = (alloc_func)0;
3535
stream.zfree = (free_func)0;
3636
stream.opaque = NULL;
3737

3838
err = deflateInit(&stream, level);
39-
if (err != Z_OK) return err;
39+
if (err != Z_OK)
40+
return err;
4041

4142
err = deflate(&stream, Z_FINISH);
4243
if (err != Z_STREAM_END) {
@@ -51,17 +52,15 @@ int ZEXPORT compress2 (unsigned char *dest, uLong *destLen, const unsigned char
5152

5253
/* ===========================================================================
5354
*/
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) {
5656
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
5757
}
5858

5959
/* ===========================================================================
6060
If the default memLevel or windowBits for deflateInit() is changed, then
6161
this function needs to be updated.
6262
*/
63-
uLong ZEXPORT compressBound (uLong sourceLen)
64-
{
63+
uLong ZEXPORT compressBound(uLong sourceLen) {
6564
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
6665
(sourceLen >> 25) + 13;
6766
}

0 commit comments

Comments
 (0)